I have a package.json at:
/home/user/dev/project/package.json
If I navigate to this location:
cd /home/user/dev/project
Then run a command:
npm run compile
It works and there are no errors.
However, if I try to run the command like this
/home/user/dev/project/ npm run compile
I get a message:
zsh: permission denied: /home/user/dev/project/
Why is this happening? I have not changed the user I'm logged in as.
The first word of a command is the name of the program to run. The directory is not an executable program, so you get that error.
If you want to refer to a file in another directory, put the directory name in the filename:
npm run compile /home/user/dev/project