mixu/npm_lazy

Does NPM Lazy work with private modules at all?

shakefu opened this issue · 4 comments

We're trying to implement it for caching. I noticed in #52 and #56 there's some support, but when I run:

npm --registry http://localhost:8080 @user/package

We get in the proxy:

app debug Querying the registry (excluding node private module @user%2fpackage): https://registry.npmjs.com/@user%2fpackage

And NPM shows:

$ npm --registry http://localhost:5001 install @user/package
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/5.7.0/bin/node" "/usr/local/bin/npm" "--registry" "http://localhost:5001" "install" "@user/package"
npm ERR! node v5.7.0
npm ERR! npm  v3.6.0
npm ERR! code E404

npm ERR! 404 Not found : @user/package
npm ERR! 404
npm ERR! 404  '@user/package' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/npm-debug.log

Is this the expected behavior? Or is there a way to get this to work with private packages, even if it's just a passthrough to registery.npmjs.org?

Edit: For clarity and security, I changed our private package name to @user/package, but we're actually trying a real install, which works without --registry

Never mind.

Got it to work by running npm --registry http://localhost:8080 login.

Probably should add that to the docs, unless it's already there, in which case I should've read better.

Strange, even after following the same steps, I'm still unable to specify a private module - install continues to fail with E404.

If you tried to retrieve the package before logging in, you may have caused npmlazy to cache a 404. If you restart/clear the cache and login before trying to pull private packages it works for me.

Worked like a charm, thanks @shakefu :)

Btw, writing a full comment just to add all details:

  1. I restarted npm_lazy to find out cache location (it prints to console after starting)
  2. removed all content inside cache location
  3. ran npm --registry http://localhost:8080 login as @shakefu recommended and logged in with my npmjs user & password
  4. restarted npm_lazy once again for any reason

and now it works perfectly with private packages