找不到Angular2 / 4模块:错误:无法解析'.. \ app'中的'three'解析'.. \ app'中的'three'

时间:2017-11-23 20:05:17

标签: node.js angular typescript npm

我是角度和打字稿的新手,我正在努力导入@ types /三个npm包,我只是创建一个新的角度项目,我尝试导入并使用三个包但我不断收到此错误

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);

}

1 个答案:

答案 0 :(得分:0)

首先安装所需的软件包。

<?php

$myFruit = 'apple';
$fruits = array( 
    '0' => array('banana', 'cherry'),
    '1' => array('apple', 'pear'),
    '2' => array('apple', 'kiwi')
);

foreach($fruits as $key => $fruit) {;
    if(in_array($myFruit, $fruit)) {
        echo $key;
        break;// THIS WILL BREAK THE FOREACH LOOP
    }
}

?>

然后只需从yarn add three @types/three

导入Vector3
"three"