![](/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.