2017-11-23 6 views
-1

私は角度とタイプスクリプトで新規です。輸入のために、@タイプ/ 3 NPMパッケージを苦労し、私はちょうど新鮮な角度プロジェクトを作成し、私は3つのパッケージをインポートして使用しようが、私はいくつかのニュービー間違いなく、私がやっている必要があります。このエラーにAngular2/4モジュールが見つかりません:エラー: '.. app'で 'three'を解決できません '.. app'で 'three'を解決してください

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

} 
+0

からVector3をインポートし、このファイルに関連するパスとして正しいパス「3」ですか? –

答えて

0

最初に必要なパッケージをインストールしてください。

yarn add three @types/three 

は、それからちょうど"three"

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

} 
+0

ありがとう、それは働いた。私は糸をインストールし、ちょうどこのコマンドラインを実行します、私はalredyがnpmでインストールしたwierd beacuseです。 –

関連する問題