Permission denied running npm custom script
<p>I've recently adopted NPM for executing automated Jenkins tasks, but when I try to run my scripts I face this "permission denied" error, as follows</p>

<pre><code>$ npm run check
&gt; ./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
</code></pre>

<ul>
<li>When I execute jshint via gulp it works fine.</li>
<li>Jenkins user is the owner at workspace directory.</li>
<li>All files are granted with execute permissions within workspace directory.</li>
<li>I'm using NVM to switch between node.js and npm, and Jenkins user is owner of the NVM directory.</li>
<li>I face this problem specifically on Jenkins server. It runs perfect locally.</li>
<li>My server is running Ubuntu 14.04</li>
</ul>