![](/img/trans.png)
[英]Error: Module not found: Error: Can't resolve src/app/app.component.css?ngResource Angular
[英]Angular2/4 Module not found: Error: Can't resolve 'three' in '..\app' resolve 'three' in '..\app'
我是angular和Typescript的新手,我正在為導入@ types / three npm包而苦苦掙扎,我只是創建了一個新的angular項目,我嘗試導入並使用這三個包,但是我一直收到此錯誤
Module not found: Error: Can't resolve 'three' in 'E:\wamp64\www\pro-website-angular5\src\app'
我一定是在做一些新的錯誤,但我不知道,這是我的代碼
import { Component } from '@angular/core';
import * as THREE from 'three';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent{
title = new THREE.Vector3(1,1,1);
}
首先安裝所需的軟件包。
yarn add three @types/three
然后從"three"
導入Vector3
import { Component } from '@angular/core';
import { Vector3 } from "three";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent{
title = new Vector3(1,1,1);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.