1.Error: Cannot find module 'bower'( Cannot find module 'XXX')

npm 错误总结(不定期更新)

找不到bower  (缺少这个)

解决办法:npm install bower   (npm install XXX)

这种情况一般是少安装某个依赖包所导致的   可以直接运行 npm install  然后在 npm run dev 或者 npm run start 试一下。

 

 

2.Port 4200 is already in use. Use '--port' to specify a different port  

出现这个问题就是端口被占用,

解决办法:ng serve --port 4201  

npm 错误总结(不定期更新)

单纯的敲了这一行命令之后

你会发现还是不行

 因为还要修改  node_modules\@angular\cli\lib\config\schema.json  中的 serve 下的 "default":4201

在运行

        

npm 错误总结(不定期更新)

 

然后在运行 就可以了

3.ERROR in multi script-loader!./~/bootstrap/dist/js/bootstrap.bundle.js
Module not found: Error: Can't resolve 'D:\angular\ng\customer-app\node_modules\bootstrap\dist\js\bootstrap.bundle.js' in 'D:\angular\ng\customer-app\node_modules\@angular\cli\mode
ls\webpack-configs'
 @ multi script-loader!./~/bootstrap/dist/js/bootstrap.bundle.js

 

npm 错误总结(不定期更新)

ng serve  的时候报的错

意思是找不到解析不了这个模块

后面跟了一串路径   很明显路径写错了

添加路径的地方只有  angular-cli.json里面  (ng6 angular-cli好像改名了)

npm 错误总结(不定期更新)

根据报错提示 打开angular-cli.json  找到 scripts  再打开文件夹对比  

很明显我路径引入的时候多写了一个bundle

删除了在运行

ng  serve   

 npm 错误总结(不定期更新)

报错完美解决

相关文章: