npm / npm-registry-client

http://npm.im/npm-registry-client
ISC License
264 stars 108 forks source link

Add user does not work #70

Closed mamobyz closed 9 years ago

mamobyz commented 9 years ago

I am experiencing the same issue as described in https://github.com/npm/npm-registry-couchapp/issues/199. The issue is caused by the changes in npm-registry-client/lib/adduser.js done in the commit c96fc63f54a5c81620ee5e21b1d37c816f9e97d6. There url.resolve() is used to replace request.toRegistryURL(), so that the path segments of the registry URL get truncated. For instance, in case of npm-registry-couchapp, the base URL has the shape of http://host:port/registry/_design/app/_rewirte. After applying url.resolve(), the request URL looks like http://host:port/-/user/org.couchdb.user:*, which is rejected by CouchDB, since the dash sign in the URL is recognized as a database name which is not allowed in CouchDB.

Configuring a virtual host in CouchDB for the npm-registry-couchapp is not always an option.

othiym23 commented 9 years ago

Configuring a virtual host in CouchDB for the npm-registry-couchapp is not always an option.

This is true. I have a fix in mind and it's pretty easy to implement, so I'll probably get that out today and include it in npm@2.0.3. It turns out that url.resolve is a little tricky to use correctly!

mamobyz commented 9 years ago

Great, thanks!

fchambo commented 9 years ago

Here is another example of a not working non-root registry. Please consider this in your fix. Thanks!

othiym23 commented 9 years ago

This is actually a bit more involved than I originally thought it was, but my current goal is to get this into npm@2.1.6, which will become npm@next this upcoming Thursday. There are a bunch of minor fixes I need to make to npm-registry-client to deal properly with non-root registry base URLs. Sorry for the delay!