我尝试安装 angular/cli 最新版本 1.0.0。
我可以轻松地使用 npm install -g @angular/cli@latest
成功安装。
但是,当我使用 ng
命令时,我可以看到'ng command not find'
。
我使用 zsh。这是我的 zshrc。
我在我的 zshrc 中写了这个。
导出 PATH="/usr/local/Cellar/6.10.2/bin:$PATH"
如果您有任何解决此问题的想法,请告诉我。 谢谢! :D
最佳答案
终于找到解决办法了。 正如我提到的,这是路径问题。 我只是不知道如何解决这个问题。 我希望它能帮助其他和我遇到同样问题的人。 我考虑了下一步,问题就解决了。
首先,删除您安装的节点
-
npm config get prefix
-
cd [the path you get above]
-
cd lib && rm -rf node_modules
-
cd /usr/local/lib && sudo rm -rf node*
-
cd /usr/local/include & sudo rm -rf node*
-
brew uninstall node (if you installed node with brew)
-
cd /usr/local/bin
-
sudo rm -rf npm
-
sudo rm -rf node
以防万一,
10.sudo rm -rf /usr/local/share/man/man1/node.1
11.sudo rm -rf /usr/local/lib/dtrace/node.d
12.sudo rm -rf ~/.npm
其次,在网站上再次安装node.js。
三、安装@angular/cli
npm install -g @angular/cli@latest
第四,检查您安装的节点路径。
npm get prefix
第五,编辑 zshrc 或 bashrc 上的路径,无论您使用什么。
alias ng="**/usr/local/lib/node_modules/lib**/node_modules/@angular/cli/bin/ng"
完成了!
这不是一个好的解决方案。 不适用于 ng new 或其他命令。
关于angular - 找不到 ng 命令(@angular/cli 1.0.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43458334/