Ahmet Eroğlu
Ahmet Eroğlu

Reputation: 724

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.

Upvotes: 3

Views: 6527

Answers (1)

Kirill Loban
Kirill Loban

Reputation: 21

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.

Upvotes: 2

Related Questions