权限被拒绝运行npm自定义脚本

时间:2016-04-06 13:42:27

标签: node.js bash ubuntu jenkins npm

我最近采用了NPM来执行自动Jenkins任务,但是当我尝试运行我的脚本时,我面临这个“权限被拒绝”的错误,如下所示

$ npm run check
> ./node_modules/jshint/bin/jshint --reporter ./node_modules/jshint-stylish/index.js test/* lib/*

sh: 1: ./node_modules/jshint/bin/jshint: Permission denied

npm ERR! my-service@1.12.6 check: `./node_modules/jshint/bin/jshint --reporter ./node_modules/jshint-stylish/index.js test/* lib/*`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the my-service@1.12.6 check script.
npm ERR! This is most likely a problem with the my-service package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./node_modules/jshint/bin/jshint --reporter ./node_modules/jshint-stylish/index.js test/* lib/*
npm ERR! You can get their info via:
npm ERR!     npm owner ls my-service
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-48-generic
npm ERR! command "/var/lib/jenkins/.nvm/v0.10.40/bin/node" "/var/lib/jenkins/.nvm/v0.10.40/bin/npm" "run" "check"
npm ERR! cwd /jenkins/jobs/my-service-development-check/workspace
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /jenkins/jobs/my-service-development-check/workspace/npm-debug.log
npm ERR! not ok code 0
  • 当我通过gulp执行jshint时,它可以正常工作。
  • Jenkins用户是工作区目录的所有者。
  • 所有文件都在工作区目录中被授予执行权限。
  • 我正在使用NVM在node.js和npm之间切换,而Jenkins用户是NVM目录的所有者。
  • 我特意在Jenkins服务器上遇到这个问题。它在当地运行完美。
  • 我的服务器正在运行Ubuntu 14.04

0 个答案:

没有答案