3周前,我使用@ angular/cli生成了Angular 4應用程序。 2周後,我試着用命令行"ng serve"
運行它,但我下面的提示一個錯誤:如何解決在Angular 4中找不到模塊'typescript'?
Cannot find module 'typescript'
Error: Cannot find module 'typescript'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\mypc\Documents\Angular Projects\my-angular-app\node_modules\@angular\cli\models\config\config.js:5:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
你有任何想法如何解決這一問題?謝謝。
您是否在全球安裝'typescript'? – Aravind
嗨@Aravind我沒有在全球安裝打字稿...... –
在全球安裝並在環境變量中設置路徑。 – Aravind