title: Build nodejs Fail with exit status 126 - Permission denied
body: <p>I faced a issue when I do a npm start in my linux server. </p>
  
  <p>It is showing error with exit  code 126 and permission denied.</p>
  
  <p>I have already done <code>chmod 777</code> to server.js or rather to the whole folder of demoTest.</p>
  
  <p>How do I fixed  this?</p>
  
  <p>The log is shown as below.</p>
  
  <pre><code>info it worked if it ends with ok
  1 verbose cli [ '/opt/node-v8.11.3-linux-x64/bin/node', '/bin/npm', 'start' ]
  2 info using npm@5.6.0
  3 info using node@v8.11.3
  4 verbose run-script [ 'prestart', 'start', 'poststart' ]
  5 info lifecycle demoTest@1.0.0~prestart: demoTest@1.0.0
  6 info lifecycle demoTest@1.0.0~start: demoTest@1.0.0
  7 verbose lifecycle demoTest@1.0.0~start: unsafe-perm in lifecycle true
  8 verbose lifecycle demoTest@1.0.0~start: PATH: /opt/node-v8.11.3-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/useradmin/demoTest/node_modules/.bin:/sbin:/bin:/usr/sbin:/usr/bin
  9 verbose lifecycle demoTest@1.0.0~start: CWD: /home/useradmin/demoTest
  10 silly lifecycle demoTest@1.0.0~start: Args: [ '-c', 'nodemon ./rest/server.js' ]
  11 silly lifecycle demoTest@1.0.0~start: Returned: code: 126  signal: null
  12 info lifecycle demoTest@1.0.0~start: Failed to exec start script
  13 verbose stack Error: demoTest@1.0.0 start: `nodemon ./rest/server.js`
  13 verbose stack Exit status 126
  13 verbose stack     at EventEmitter.&lt;anonymous&gt; (/opt/node-v8.11.3-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
  13 verbose stack     at emitTwo (events.js:126:13)
  13 verbose stack     at EventEmitter.emit (events.js:214:7)
  13 verbose stack     at ChildProcess.&lt;anonymous&gt; (/opt/node-v8.11.3-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
  13 verbose stack     at emitTwo (events.js:126:13)
  13 verbose stack     at ChildProcess.emit (events.js:214:7)
  13 verbose stack     at maybeClose (internal/child_process.js:925:16)
  13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  14 verbose pkgid demoTest@1.0.0
  15 verbose cwd /home/useradmin/demoTest/rest
  16 verbose Linux 3.10.0-862.el7.x86_64
  17 verbose argv "/opt/node-v8.11.3-linux-x64/bin/node" "/bin/npm" "start"
  18 verbose node v8.11.3
  19 verbose npm  v5.6.0
  20 error code ELIFECYCLE
  21 error errno 126
  22 error demoTest@1.0.0 start: `nodemon ./rest/server.js`
  22 error Exit status 126
  23 error Failed at the demoTest@1.0.0 start script.
  23 error This is probably not a problem with npm. There is likely additional logging output above.
  24 verbose exit [ 126, true ]
  </code></pre>