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...
- Changing
always-auth
totrue
orfalse
- Running as Super User
- Trying different tokens
- using
_authToken
instead of_auth
- Google, a lot, but it turns out my problem is very unique.
npm login --registry=
with both--auth=TOKEN_OMITTED
and--authToken=TOKEN_OMITTED
where npm tells menpm 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...
- Changing
always-auth
totrue
orfalse
- Running as Super User
- Trying different tokens
- using
_authToken
instead of_auth
- Google, a lot, but it turns out my problem is very unique.
npm login --registry=http://nexus.OMMITED./repository/npm-all
with both--auth=TOKEN_OMITTED
and--authToken=TOKEN_OMITTED
where npm tells menpm 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 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
3 Answers
Reset to default 6I 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条)