我在链接中使用示例来学习角度。但是当我运行npm start 时,它显示错误。我搜索了要求更新 npm 或 angular 版本的解决方案,但我已经在使用最新的,如下所示
npm -v = 6.4.1
节点-v = 10.9.0
角度 CLI = 6.1.5
我正在使用 Windows 7
> apm@0.0.0 start F:\Angular\Angular-GettingStarted-master\APM-Start
> ng serve -o
npm ERR! file bash
npm ERR! path bash
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn bash
npm ERR! apm@0.0.0 start: `ng serve -o`
npm ERR! spawn bash ENOENT
npm ERR!
npm ERR! Failed at the apm@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AppData\Roaming\npm-cache\_logs\2018-09-
05T16_12_41_076Z-debug.log
Run Code Online (Sandbox Code Playgroud)
您的节点版本似乎太高了。请将节点版本降级到 8.9.0。(确认您的 npm 版本也根据节点降级)。
删除您的node_modules文件夹。
然后依次运行命令:
npm cache clean --force
npm install
npm rebuild node-sass
然后尝试: ng serve