Van Coding
Van Coding

Reputation: 24554

npm install - how to run build scripts with sufficient permissions?

I've created a node-module that has a build script that gets called after the installation. The build script clones a git repository and copies some files of it to another folder. The problem: on npm install, the script does not get sufficient permissions and I get the following error:

sh: ./build.js: Permission denied

How can I give the build script sufficient permissions to do its job?

I want that the users just can do npm install mymodule and the build-script then does its job on any system.

Any ideas?

Upvotes: 26

Views: 20103

Answers (1)

Pascal Belloncle
Pascal Belloncle

Reputation: 11389

Do you have the x flag on build.js?

chmod +x build.js

And the first line of your script should tell how to execute the script from the shell:

#!/usr/bin/env node

Upvotes: 58

Related Questions