title: TypeError: The header content contains invalid characters when doing npm whoami and npm install
body: <p>Here's the error message my colleague gets when he does <code>npm whoami</code>:</p>
  
  <pre><code>npm ERR! Darwin 14.5.0
  npm ERR! argv "/Users/dariusgatlin/.nvm/versions/node/v4.4.7/bin/node" "/Users/dariusgatlin/.nvm/versions/node/v4.4.7/bin/npm" "whoami"
  npm ERR! node v4.4.7
  npm ERR! npm  v2.15.8
  
  npm ERR! The header content contains invalid characters
  npm ERR! 
  npm ERR! If you need help, you may report this error at:
  npm ERR!     &lt;https://github.com/npm/npm/issues&gt;
  
  npm ERR! Please include the following file with any support request:
  npm ERR!     /Users/dariusgatlin/WebstormProjects/account-service/npm-debug.log
  </code></pre>
  
  <p><code>npm login</code> works, but <code>npm install</code> produces the same error message</p>
  
  <p>Here is the npm-debug log</p>
  
  <pre><code>17 http request GET https://registry.npmjs.org/-/whoami
  18 verbose stack TypeError: The header content contains invalid characters
  18 verbose stack     at ClientRequest.OutgoingMessage.setHeader (_http_outgoing.js:351:13)
  18 verbose stack     at new ClientRequest (_http_client.js:79:14)
  18 verbose stack     at Object.exports.request (http.js:31:10)
  18 verbose stack     at Object.socket.once.exports.request (https.js:182:15)
  18 verbose stack     at Request.start (/Users/dariusgatlin/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/request/request.js:753:32)
  18 verbose stack     at Request.end (/Users/dariusgatlin/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/request/request.js:1418:10)
  18 verbose stack     at end (/Users/dariusgatlin/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/request/request.js:580:14)
  18 verbose stack     at Immediate._onImmediate (/Users/dariusgatlin/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/request/request.js:594:7)
  18 verbose stack     at processImmediate [as _immediateCallback] (timers.js:383:17)
  19 verbose cwd /Users/dariusgatlin/WebstormProjects/account-service
  20 error Darwin 14.5.0
  21 error argv "/Users/dariusgatlin/.nvm/versions/node/v4.4.7/bin/node" "/Users/dariusgatlin/.nvm/versions/node/v4.4.7/bin/npm" "whoami"
  22 error node v4.4.7
  23 error npm  v2.15.8
  24 error The header content contains invalid characters
  25 error If you need help, you may report this error at:
  25 error     &lt;https://github.com/npm/npm/issues&gt;
  26 verbose exit [ 1, true ]
  </code></pre>
  
  <p>Debugging steps tried include:</p>
  
  <ul>
  <li>restart machine</li>
  <li>Reinstall Node version</li>
  <li>try several different Node versions, including old ones and new ones</li>
  </ul>
  
  <p>Possibly-related note about the error: <a href="http://www.alexkras.com/typeerror-the-header-content-contains-invalid-characters/" rel="nofollow">http://www.alexkras.com/typeerror-the-header-content-contains-invalid-characters/</a></p>