简体   繁体   English

Angular CLI 拒绝传入 ng 命令

[英]Angular CLI refuses to pass in ng command

I have been trying since last week to install the Angular CLI correctly in my Mac.自上周以来,我一直在尝试在我的 Mac 中正确安装 Angular CLI。 I have concluded that it might be Apple's new operating system (Mac OS Catalina) that isn't letting me advance in any way.我得出的结论是,可能是苹果的新操作系统(Mac OS Catalina)没有让我以任何方式进步。

I have tried uninstalling node.js and installing it back, uninstalling the Angular CLI, restarting terminal, and restarting my mac.我尝试卸载 node.js 并将其重新安装,卸载 Angular CLI,重新启动终端,然后重新启动我的 mac。 Nothing seems to work.似乎没有任何效果。 I have already tried我已经试过了


 npm install -g @angular-cli

And


npm link @angular/cli

Keep in mind I have Mac OS Catalina installed as well as Z shell instead of bash since it asked me much earlier to upload it.请记住,我安装了 Mac OS Catalina 以及 Z shell 而不是 bash,因为它更早地要求我上传它。

Finally, I solved it.最后,我解决了。 It took some experimenting and deep search about the topic to solve it.对这个主题进行了一些实验和深入搜索来解决它。

The main thing happening was that the ng command didn't exist.发生的主要事情是 ng 命令不存在。 I knew this but I had no idea how to solve it.我知道这一点,但我不知道如何解决它。 Eventually, I figured out there's a directory called node_modules in the cd ~/ of the terminal.最终,我发现终端的cd ~/中有一个名为 node_modules 的目录。 In the end, I traveled down to the alias @angular/cli/bin/ng within the cd ~/node-modules (@angular was the only one there) Furthermore, I made the ng alias myself...最后,我去了cd ~/node-modules中的别名 @angular/cli/bin/ng (@angular 是那里唯一的一个)此外,我自己制作了 ng 别名......

alias ng="~/node_modules/@angular/cli/bin/ng"

Thant's all it took?仅此而已? Does anyone know why the ng command wasn't there already?有谁知道为什么 ng 命令不存在?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM