title: Publishing to npm with Travis CI
body: <p>How do I publish to npm using Travis CI? I've tried the following .travis.yml:</p>
  
  <pre><code>language: nodejs
  node_js:
  - '6'
  - '6.1'
  - '5.11'
  before_script:
  - npm install -g nodeunit
  script: nodeunit
  deploy:
    provider: npm
    email: my_email
    api_key: "encrypted"
  </code></pre>
  
  <p>But when it comes to the npm bit , I get:</p>
  
  <pre><code>npm ERR! publish Failed PUT 400
  npm ERR! Error: Not found : package-name
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>With </p>
  
  <pre><code>api_key:
     secure: "..." 
  </code></pre>
  
  <p>I get another error:</p>
  
  <pre><code>NPM API key format changed recently. If your deployment fails, check your
  API key in ~/.npmrc.
  http://docs.travis-ci.com/user/deployment/npm/
  ~/.npmrc size: 53
  env: &lt;this is my unencrypted api key&gt;: No such file or directory
  </code></pre>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>Finally solved it. The npm version on travis was really old (1.4.28). All I had to do was to put a :</p>
  
  <pre><code>before_script:
  - npm install -g npm@'&gt;=3'
  </code></pre>
  
  <p>And now it works!</p>