javascript - NPM registry install fails on non-registry dependencies - Stack Overflow

I'm trying to install my Ionic App through the registry with it's dependencies.I try to achi

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/repository/:_auth=OMMITED
registry=
always-auth=true

When watching the mand 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 mand: .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= 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.

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./repository/:_auth=OMMITED
registry=http://nexus.OMMITED./repository/npm-all
always-auth=true

When watching the mand 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 mand: 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./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.
Share Improve this question edited Aug 12, 2018 at 12:42 Vanitas asked Aug 9, 2018 at 15:17 VanitasVanitas 9031 gold badge7 silver badges19 bronze badges 2
  • I'm noticing the first line of your npmrc file appears to be a ment using //. Per the npmrc docs ments don't use // for ments, but instead # or ;. Not sure how this would necessarily affect it, but something to try changing. – obermillerk Commented Aug 18, 2018 at 14:38
  • Additionally, is that first line attempting to set _auth for a scope of the url? you should try setting just _auth to your token to see if that works. If you need to scope things, the docs I linked in my previous ment seem to indicate that to scope something you do @scope:_auth=... so that's something to try. (Here's some docs on npm scope to checkout if you're curious) – obermillerk Commented Aug 18, 2018 at 14:52
Add a ment  | 

3 Answers 3

Reset to default 6

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

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

While my ~/.npmrc looks like this:

//nexus.OMITTED./repository/:_authToken=OMITTED
registry=http://nexus.OMITTED./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.

You'd want to use npm login with Nexus Repo 3:

https://help.sonatype./display/NXRM3/Node+Packaged+Modules+and+npm+Registries#NodePackagedModulesandnpmRegistries-AuthenticationUsingRealmandLogin

And make sure the npm bearer token realm is enabled under "security/realms" in the Nexus UI.

That said, the error is 403, not 401. This means you're getting rejected due to permissions. I suggest checking the nexus request.log and making sure the 403's are ing from Nexus. They could be ing from your http proxy server. If they are ing from Nexus it means the user has been authenticated, but doesn't have permissions in nexus to download from that repo.

Try this mand after changing .npmrc file npm run npm-auth

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744301882a4567540.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信