2017-05-06 162 views
0

我有TypeScript 2.3.2。我用口水。錯誤:無法找到模塊'三'

我安裝three.js所這樣的:

npm install @types/three --save-dev 

當我寫命令gulp我看到的錯誤:

Error: Cannot find module 'three' from 
'E:\_Projects\8observer8.bitbucket.io\ThreeJS\BattleCity3D\src' 

截圖:https://yadi.sk/d/wDK1SZ6U3HkCzu

+0

這是當我評論這一行:進口*三從 「三」;並將其替換爲/// 爲什麼? – 8Observer8

+0

解決問題時不要編輯標題,而是寫一個自己問題的答案。 –

+0

此外,避免代碼的截圖。將問題本身的相關代碼作爲預先格式化的文本。 –

回答

1

解決方案

我更換這一行:

// this line does't work. Error: Cannot find module 'three' from ... 
import * as THREE from "three"; 

通過這樣的:

/// <reference path="../node_modules/@types/three/index.d.ts" />