npm install - 如何以足够的权限运行构建脚本? [英] npm install - how to run build scripts with sufficient permissions?

查看:56
本文介绍了npm install - 如何以足够的权限运行构建脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个节点模块,它有一个在安装后调用的构建脚本.构建脚本克隆一个 git 存储库并将其中的一些文件复制到另一个文件夹.问题:在 npm install 上,脚本没有获得足够的权限,我收到以下错误:

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: 权限被拒绝

我怎样才能给构建脚本足够的权限来完成它的工作?

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

我希望用户可以执行 npm install mymodule 并且构建脚本然后在任何系统上执行它的工作.

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

有什么想法吗?

推荐答案

你在 build.js 上有 x 标志吗?

Do you have the x flag on build.js?

chmod +x build.js

脚本的第一行应该说明如何从 shell 执行脚本:

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

#!/usr/bin/env node

这篇关于npm install - 如何以足够的权限运行构建脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆