When I run my Angular project by ng serve
, it gives this error:
bash: /usr/bin/ng: No such file or directory
I have
I faced the same problem and here is what worked for me.
ls -la ~/ | more
emacs ~/.bashrc
ng
directory alias ng="/usr/local/lib/node_modules/@angular/cli/bin/ng"
4.save the file and install it by running sudo source ~/.bashrc
Now test by running ng -v
Looks like you had run npm install -g @angular/cli
with root.
Try to remove angular-cli and then reinstall with sudo
sudo npm remove -g @angular/cli
sudo npm install -g @angular/cli
Use this command ,I resolved my issue after angular cli installed
alias ng="/usr/local/lib/node_modules/@angular/cli/bin/ng"
I reinstalled angular and then restarted the terminal. It worked fine
I've run into this issue when @agnular/cli
is intended to be installed on CI.
I resolved this by simply creating an empty folder just before you're about to execute any of ng-related commands
$ mkdir node_modules
$ ng --version
Run this in root
$ sudo su
# sudo npm install -g @angular/cli