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

匿名 (未验证) 提交于 2019-12-03 02:20:02

问题:

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?

回答1:

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 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!