Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular NG command gives permission error

When I try to run, "ng serve" or any other ng command, I'm getting "zsh: permission denied: ng" error.

I'm using MACOS and already checked other posts to fix the problem but nothing helps, sadly. How can I change the permissions of a folder ( i also dont know which folder i should be working with) to fix my profile.

like image 693
Ahmet Eroğlu Avatar asked Apr 26 '26 19:04

Ahmet Eroğlu


1 Answers

You just need to allow ng commands to execute with "chmod +x <script_path>" command. How I solved this:

  1. Switched to default bash shell: chsh -s /bin/bash;

  2. Restarted OS;

  3. Opened a terminal and tried any ng <command>. The result looked something like this

    bash: /usr/local/bin/ng : permission denied

  4. Took the ng directory from the previous result and allowed to execute ng commands

    chmod +x /usr/local/bin/ng

  5. Executed my ng command.

There is probably more elegant way to do the same stuff, but this worked just fine.
You can switch back to zsh by writing chsh -s /bin/zsh.

like image 200
Kirill Loban Avatar answered Apr 29 '26 08:04

Kirill Loban



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!