问题描述
我在安装 angular-cli 时遇到了麻烦,因为它无法识别我的 git bash 中的 ng 命令,但它可以在 Windows 7 上的 cmd 中运行.
I'm getting into trouble with anngular-cli installation because it doesn't recognize the ng command in my git bash but it works in my cmd on Windows 7.
我在网上查找了一些问题,但没有真正找到解决方案.
I looked for some issues on the web but I didn't really find a solution.
这里是错误:
ng -v
module.js:549
throw err;
^
Error: Cannot find module 'C:\Program
Files\Git\node_modules\@angular\cli\bin\ng'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
这个错误是我在全局安装 Node 和 angular-cli 后第一次使用 ng 时发生的.
This error happened the first time I used ng after installing Node and angular-cli globally.
我在使用 Windows 10 的笔记本电脑上工作时没有收到此错误.
I didn't get this error when I was working on my laptop on Windows 10.
推荐答案
问题:
错误:找不到模块'..\AppData\Roaming\npm\node_modules\angular-cli\bin\ng' angularJs
解决方案:
如果你已经安装了 angular cli,请卸载它
uninstall angular cli if you have already installed it
npm uninstall -g @angular/cli
删除 C:\Users\Satish\AppData\Roaming\npm\node_modules@angular 文件夹,如果它在卸载后仍然存在
Delete the C:\Users\Satish\AppData\Roaming\npm\node_modules@angular folder if it still exists after the uninstall
全局重新安装angular-cli
reinstall angular-cli globally
npm install -g @angular/cli
这篇关于找不到模块@angular\cli\bin\ng的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!