Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM registry install fails on non-registry dependencies

I'm trying to install my Ionic App through the registry with it's dependencies. I try to achieve this with npm i --loglevel verbose while my ~/.npmrc looks like this:

//nexus.OMMITED.com/repository/:_auth=OMMITED
registry=http://nexus.OMMITED.com/repository/npm-all
always-auth=true

When watching the command run it seems to go just fine, until we hit other non-registry dependencies, suddenly I'm met with an authorisation error.

Here is a paste of the command: https://hasteb.in/hejigopo.sql

As you see it fails on @angular/[email protected] in this instance, but this variables between random @angular dependencies or @ionic-native

What I have tried so far...

  1. Changing always-auth to true or false
  2. Running as Super User
  3. Trying different tokens
  4. using _authToken instead of _auth
  5. Google, a lot, but it turns out my problem is very unique.
  6. npm login --registry=http://nexus.OMMITED.com/repository/npm-all with both --auth=TOKEN_OMITTED and --authToken=TOKEN_OMITTED where npm tells me npm WARN invalid config auth-type="TOKEN_OMITTED" and prompts for a username, my username however is an email address which throws this error: npm WARN Name may not contain non-url-safe chars only to infinitely keep prompting for another username.
like image 601
Vanitas Avatar asked Aug 09 '18 15:08

Vanitas


1 Answers

I don't know how, or why, but somehow it works now if I specify the full registry in the command likeso:

npm --registry=http://nexus.OMITTED.com/repository/npm-all/ install

While my ~/.npmrc looks like this:

//nexus.OMITTED.com/repository/:_authToken=OMITTED
registry=http://nexus.OMITTED.com/repository/npm-all/
_auth=OMITTED
[email protected]

None of this makes sense to me whatsoever, but I'm glad it works for a change.

If anyone ends up writing a proper answer to this as to why this works, how this works and why the normal way doesn't, then I will gladly accept it as the answer and reward the bounty.

like image 137
Vanitas Avatar answered Nov 03 '22 15:11

Vanitas