title: Howto publish private projects to Sinopia (npm adduser for private registry fails)
body: <p>Ok so I finally managed to get a private npm registry using Sinopia. <strong>But I cannot publish anything to it.</strong></p>
  
  <blockquote>
    <p>TL;DR: Sinopia does not support <em>npm adduser</em>, but has its own user
    management. Also npm needs a valid user created before <em>npm publish</em>
    through <em>npm adduser</em>, which fails because the internal Sinopia server
    throws an error at the unsupported command....</p>
  </blockquote>
  
  <h3>How does one use Sinopia as a private registry with proper users and passwords</h3>
  
  <ol>
  <li>create a global user in npmjs.org, and then another with the same password in Sinopia? </li>
  <li>Or is there an easier way to tell npm to just use a fixed user/pass. </li>
  <li>Or even better prompt me somehow for username and password?</li>
  <li>something else?</li>
  </ol>
  
  <hr>
  
  <p>Synopsis: </p>
  
  <p>Sinopia does not depend on Couch.DB and will hapilly fetch packages it does not already have from a master (default is the global npmjs.org).</p>
  
  <p>Sinopia starts perfectly and is configured to listen on all interfaces. It works wonders in serving packages to </p>
  
  <pre><code>npm install
  </code></pre>
  
  <p>I even configured ~/.npmrc to always point to the internal registry.</p>
  
  <p>All projects' package.json file is set to </p>
  
  <pre><code>  ....
    "publishConfig" : {
       "registry" : "http://internal-npm:4873"
    },
    ....
  </code></pre>
  
  <p>Also I managed to add custom users in sinopia by manipulating the config.yaml with the help of js-yaml</p>
  
  <pre><code>crypto.createHash('sha1').update('theBigPassword').digest('hex')
  </code></pre>
  
  <p>Now I am stuck at </p>
  
  <pre><code>npm --registry=http://internal-npm:4873 --ca=null publish
  </code></pre>
  
  <p>After a long wait I get:</p>
  
  <pre><code>npm ERR! need auth auth and email required for publishing
  npm ERR! need auth You need to authorize this machine using `npm adduser`
  
  npm ERR! System Linux 3.11.0-18-generic
  npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "--registry=http://internal-npm:4873" "--ca=null" "publish"
  npm ERR! cwd /home/ciprian/workspace/netop-npm
  npm ERR! node -v v0.10.15
  npm ERR! npm -v 1.2.18
  npm ERR! code ENEEDAUTH
  npm ERR! 
  npm ERR! Additional logging details can be found in:
  npm ERR!     /home/ciprian/workspace/netop-npm/npm-debug.log
  npm ERR! not ok code 0
  </code></pre>
  
  <p>The business end of the log file tells me that the user is not optional</p>
  
  <pre><code>86 error need auth auth and email required for publishing
  86 error need auth You need to authorize this machine using `npm adduser`
  87 error System Linux 3.11.0-18-generic
  88 error command "/usr/bin/nodejs" "/usr/bin/npm" "--registry=http://internal-npm:4873" "--ca=null" "publish"
  89 error cwd /home/ciprian/workspace/netop-npm
  90 error node -v v0.10.15
  91 error npm -v 1.2.18
  92 error code ENEEDAUTH
  93 verbose exit [ 1, true ]
  </code></pre>
  
  <p>Now, the <strong>chicken and egg</strong> issue is that Sinopia does not support <code>npm adduser</code>, but has its own user management like I mentioned above. Also npm needs a valid user created through <code>npm adduser</code>, which fails because the internal Sinopia server throws an error at the unsupported command.</p>