在運行「故宮開始」,我收到以下錯誤:在運行將輸出文件,而不是JavaScript文件過程中發生NPM啓動錯誤2
app/app.component.ts(1,27): error TS2307: Cannot find module '@angular/core'.
app/main.ts(1,30): error TS2307: Cannot find module '@angular/platform-browser-dynamic'.
npm ERR! weird error 2
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
錯誤。我甚至嘗試了以下兩條命令:
sudo apt-get install nodejs-legacy
sudo npm update -g && sudo npm install -g concurrently lite-server typescript
但仍然錯誤仍然存在。該怎麼辦? 我使用的是Ubuntu 14.04操作系統。節點版本:6.2.0,nodejs:0.10.25並且在Angular2上工作。
你能提供你的'package.json'和'tsconfig.json'文件的內容嗎?謝謝! –
您是否在項目目錄中執行了'npm install'(而不是'-g'或其他)? – CherryDT
@CherryDT是的。它沒有奏效。然後我嘗試了'sudo npm install',它對我很有用。但仍然爲什麼它的工作,我不知道。 – hithard