在运行“故宫开始”,我收到以下错误:在运行将输出文件,而不是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