Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm link "The file is marked as an executable but could not be run by the operating system."

So I made a cli with package.json that specifies a bin file.

I npm link'd it. Then I created a new folder on my desktop and npm link foocli which installed it fine to that directory's node_modules folder.

Then I try to run the cli from that dir and it throws:

The file '/usr/local/bin/foocli' is marked as an executable but could not be run by the operating system.

Any idea what's causing this and how I can fix it?

like image 886
corysimmons Avatar asked Feb 04 '16 00:02

corysimmons


Video Answer


1 Answers

#!/usr/bin/env node is needed at the top of the file that is being executed so the shell knows how to execute the file.

like image 159
mikefrey Avatar answered Oct 20 '22 10:10

mikefrey