title: Jenkins fails to install npm packages
body: <p>Something weird is happening with my Jenkins install.</p>
  
  <p>------ 1 ------</p>
  
  <p>Here, I have a two build steps, consisting of two shell scripts:</p>
  
  <p>First: <strong>npm install jspm</strong></p>
  
  <p>Second: <strong>npm install browser-sync</strong></p>
  
  <pre><code>Checking out Revision e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 (refs/remotes/origin/master)
   &gt; git config core.sparsecheckout # timeout=10
   &gt; git checkout -f e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6
   &gt; git rev-list e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 # timeout=10
  [workspace] $ /bin/sh -xe /tmp/hudson205250999430849146.sh
  + npm install jspm
  npm WARN dxx-app@1.0.0 No repository field.
  [workspace] $ /bin/sh -xe /tmp/hudson4116699777377548210.sh
  + npm install browser-sync
  Killed
  Build step 'Execute shell' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>------ 2 ------
  If I run only one build step, running the following shell script, it breaks the jenkins service alltogether:</p>
  
  <p>Shell script: <strong>npm install browser-sync</strong></p>
  
  <pre><code>Checking out Revision e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 (refs/remotes/origin/master)
   &gt; git config core.sparsecheckout # timeout=10
   &gt; git checkout -f e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6
   &gt; git rev-list e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 # timeout=10
  [workspace] $ /bin/sh -xe /tmp/hudson3323153925792902879.sh
  + npm install browser-sync
  502 Bad Gateway
  nginx/1.4.6 (Ubuntu)
  </code></pre>
  
  <p>------ 3 ------
  If I run the following shell script, it works:
  <strong>npm install jspm</strong></p>
  
  <pre><code>Checking out Revision e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 (refs/remotes/origin/master)
   &gt; git config core.sparsecheckout # timeout=10
   &gt; git checkout -f e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6
   &gt; git rev-list e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 # timeout=10
  [workspace] $ /bin/sh -xe /tmp/hudson4962873221523396658.sh
  + npm install jspm
  npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
  npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.5
  npm WARN dxx-app@1.0.0 No repository field.
  [ArtifactDeployer] - Starting deployment from the build step ...
  [ArtifactDeployer] - 0 file(s) have been copied from the '/var/lib/jenkins/jobs/dxx-app/workspace' to 'home/danield/dxx-app'.
  [ArtifactDeployer] - Stopping deployment from the build step ...
  [workspace] $ /bin/sh -xe /tmp/hudson1033340373247995718.sh
  + chmod -R g+rwx,u+rwx /home/danield/dxx-app
  Finished: SUCCESS
  </code></pre>
  
  <p>What could cause these weird issues?</p>
  
  <p>Also, jenkins does not report any errors in it's logs, but I found something in the work space, the npm debug log:</p>
  
  <pre><code>18917 silly install bufferutil@1.2.1 /var/lib/jenkins/jobs/dxx-app/workspace/node_modules/.staging/bufferutil-db56e030b10e52f326f069d2efef3ab7
  18918 info lifecycle bufferutil@1.2.1~install: bufferutil@1.2.1
  18919 verbose lifecycle bufferutil@1.2.1~install: unsafe-perm in lifecycle true
  18920 verbose lifecycle bufferutil@1.2.1~install: PATH: /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.8/lib/node_modules/npm/bin/node-gyp-bin:/var/lib/jenkins/jobs/dxx-app/workspace/node_modules/bufferutil/node_modules/.bin:/var/lib/jenkins/jobs/dxx-app/workspace/node_modules/.bin:/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
  18921 verbose lifecycle bufferutil@1.2.1~install: CWD: /var/lib/jenkins/jobs/dxx-app/workspace/node_modules/bufferutil
  18922 silly lifecycle bufferutil@1.2.1~install: Args: [ '-c', 'node-gyp rebuild' ]
  18923 verbose stack Error: write EPIPE
  18923 verbose stack     at Object.exports._errnoException (util.js:874:11)
  18923 verbose stack     at exports._exceptionWithHostPort (util.js:897:20)
  18923 verbose stack     at WriteWrap.afterWrite (net.js:763:14)
  18924 verbose cwd /var/lib/jenkins/jobs/dxx-app/workspace
  18925 error Linux 3.13.0-57-generic
  18926 error argv "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.8/bin/node" "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.8/bin/npm" "install" "browser-sync"
  18927 error node v4.2.2
  18928 error npm  v3.5.0
  18929 error code EPIPE
  18930 error errno EPIPE
  18931 error syscall write
  18932 error write EPIPE
  18933 error If you need help, you may report this error at:
  18933 error     &lt;https://github.com/npm/npm/issues&gt;
  18934 verbose exit [ 1, true ]
  </code></pre>
  
  <p>It's a weird error which I do NOT. understand.</p>
  
  <p>I am thinking:
  - maybe jenkins has a weird timeout, when installing larger packages
  - maybe there is a size limitation for the packages
  - maybe there is something wrong with the internal builds of the packages</p>
  
  <p>Any ideas?</p>