npm install - how to run build scripts with suffic

2019-02-11 22:27发布

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?

标签: node.js npm
1条回答
来,给爷笑一个
2楼-- · 2019-02-11 22:36

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
查看更多
登录 后发表回答