草庐IT

npm install 提示Unable to authenticate, need: BASIC realm=“Sonatype Nexus Repository Manager“

喜羊羊love红太狼 2023-05-09 原文

场景:

执行npm install时提示Unable to authenticate

Password:
Email: (this IS public) xx@qq.com
Logged in as uploader on http://192.168.xx.xxx:8074/repository/npm-internal/.
PS D:\GitworkspaceUi\gisquest-cloud-ui-workcenter> npm install
npm ERR! code E401
npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2023-01-04T06_05_27_843Z-debug.log     
PS D:\GitworkspaceUi\gisquest-cloud-ui-workcenter> 

问题原因:

执行npm install到仓库拉取代码时需要认证,现在是认证不通过,因此报错 

现象:

浏览器直接访问仓库,然后使用公司给的账号和密码登录是正常的,说明账号密码是正确的

http://192.168.xx.xxx:8074/repository/npm-internal/.

解决方法:

先执行npm config list,找到.npmrc的位置

PS D:\GitworkspaceUi\gisquest-cloud-ui-workcenter> npm config list
; cli configs
metrics-registry = "http://192.168.xxx.xxx:8073/repository/npm-all/"
scope = ""
user-agent = "npm/6.14.12 node/v14.16.1 win32 x64"

; userconfig C:\Users\Administrator\.npmrc

 方法一(网上的仅供参考):

打开后大概如下效果

 删掉第二行

 //192.168.xx.xx:8073/repository/npm-all/:_authToken=NpmToken.1ee55b58-d164-3b43-a731-xxxxxx

 重新执行登录

npm login --registry=http://192.168.xx.xxx:8073/repository/npm-internal/

  方法二:直接删掉.npmrc

npm config set registry http://192.168.xx.xxxx:8073/repository/npm-all/ 

npm config set //192.168.xx.xxx:8073/repository/npm-all/:_authToken=NpmToken.1ee55b58-d164-3b43-a731-xxxxx

说明:上面第一条命令是注册仓库的位置,第二条是仓库的的认证token

这里的token是从同事(他那里是正常).npmrc文件中复制过来的

然后执行npm install正常了 

有关npm install 提示Unable to authenticate, need: BASIC realm=“Sonatype Nexus Repository Manager“的更多相关文章

  1. ruby-on-rails - Prawn PDF : I need to generate nested tables - 2

    我需要一个表,其中行实际上是2行表,一个嵌套表是..我怎样才能在Prawn中做到这一点?也许我需要延期..但哪一个? 最佳答案 现在支持子表:Prawn::Document.generate("subtable.pdf")do|pdf|subtable=pdf.make_table([["sub"],["table"]])pdf.table([[subtable,"original"]])end 关于ruby-on-rails-PrawnPDF:Ineedtogeneratenested

  2. ruby - 是否可以将 IRB 提示配置为动态更改? - 2

    我想在IRB中浏览文件系统并让提示更改以反射(reflect)当前工作目录,但我不知道如何在每个命令后进行提示更新。最终,我想在日常工作中更多地使用IRB,让bash溜走。我在我的.irbrc中试过这个:require'fileutils'includeFileUtilsIRB.conf[:PROMPT][:CUSTOM]={:PROMPT_N=>"\e[1m:\e[m",:PROMPT_I=>"\e[1m#{pwd}>\e[m",:PROMPT_S=>"FOO",:PROMPT_C=>"\e[1m#{pwd}>\e[m",:RETURN=>""}IRB.conf[:PROMPT_MO

  3. ruby - 在 StockChart (highchart) 中以编程方式显示柱形图的工具提示 - 2

    我有一个Highstock图表(带有标记和阴影的线条),并且想以编程方式显示一个highstock工具提示,例如,当我选择某个表上的一行(包含图表数据)我想显示相应的highstock工具提示。这可能吗? 最佳答案 股票图表thissolution不起作用:在thisexample你必须更换这个:chart.tooltip.refresh(chart.series[0].data[i]);为此:chart.tooltip.refresh([chart.series[0].points[i]]);解决方案可用here.

  4. ruby-on-rails - Rails 设计 : "You need to sign in or sign up before continuing" instead of "You will receive an email with instructions.." - 2

    我已经安装了DeviseonRails4.2.0,一切似乎都在工作,我使用了以下指南:http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/我的设计模块是:devise:database_authenticatable,:registerable,:confirmable,:recoverable,:rememberable,:trackable,:validatable,:omniauthable唯一的问题是,如果我尝试通过转到注册页面创建一个新帐户,然后在输入我的电子邮

  5. ruby-on-rails - 删除 rspec 中的测试 - 更改(模型,:count) failing - Why is reload needed? - 2

    TLDR:App.count需要重新加载才能看到创建的记录。为什么?我找到了很多关于测试DELETE方法的引用资料,如下所示:expect{delete_request}.tochange(App,:count).by(-1)这是有道理的,并且适用于一些类似的场景。但是,我在测试不应该执行的删除时遇到了一个问题,例如当没有用户登录时。我从这里开始,用两种方法来测试同一件事:require'rails_helper'RSpec.describeV1::AppsController,type::controllerdolet(:user){create(:user)}let(:app){c

  6. ruby-on-rails - rails : Do I need a controller for each model? - 2

    关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭9年前。Improvethisquestion我有一个包含4个模型的Rails应用程序。我只在一个Controller操作中访问这4个模型。我目前有4个不同的Controller来处理这些模型。我想知道将这4个Action塞入一个Controller是否是一种不好的做法。当前设置:classGmDataController建议的设置:classDashboardController

  7. ruby-on-rails - 提示需要散列的事件资源 - 2

    我正在使用事件资源从api获取数据并显示它,我的Controllermodel.rb有classThr::Vol::Dom'/vv/test/domains/2013-06-25T05:03Z')xendend当我调用Thr::Vol::Dom.find方法时,它返回以下错误:ArgumentError:expectedanattributesHash,got["0.0.0.0","1.1.1.1","2.2.2.2","3.3.3.3","4.4.4.4"]该api应该提供这样的内容{"abs.com":["0.0.0.0","1.1.1.1","2.2.2.2","3.3.3.3"

  8. ruby-on-rails - 修改 Rails : How do advanced users find out what needs to be changed? - 2

    我已经使用Rails几个月了,我很乐意编写一个项目并根据我的需要操作Rails等。最近我一直在尝试更高级一些,所以我尝试修改/添加到现有的Rails代码库:添加新的表单辅助方法、添加responds_to:pdf方法等...然后我遇到了很多问题。困难在于学习我需要修改哪些代码;该代码所在的位置,以及如何确保我不会错过其他文件中的相关代码。我猜人们有办法学会这样做,但目前我主要只是猜测和希望。我想我的问题是,Rails人员如何了解他们需要修改的代码在哪里编辑以及编辑代码的方法?看起来这只是您需要先熟悉的东西,但我猜必须有一种简单的方法来理解在哪里(和什么)编辑。任何想法表示赞赏.....

  9. ruby - 为什么我的带有 ANSI 颜色代码的 IRB 提示通过复制/粘贴弄乱了翻页/翻页行为? - 2

    我添加到我的.irbrc:IRB.conf[:PROMPT].reverse_merge!(:RAILS_ENV=>{:PROMPT_I=>"#{current_app}#{rails_env}#{prompt}",:PROMPT_N=>"#{current_app}#{rails_env}#{prompt}",:PROMPT_S=>nil,:PROMPT_C=>"?>",:RETURN=>"=>%s\n"})IRB.conf[:PROMPT_MODE]=:RAILS_ENV如果我这样做:current_app="\e[31mfoo_bar_app\e[0m"rails_env="\e

  10. ruby - Capistrano 3.0 — 现在如何安全地提示输入密码? - 2

    在3.0之前有一种方法可以做到这一点:#...set:mysql_password,proc{Capistrano::CLI.password_prompt"Gimmeremotedatabaseserverpassword.Don'tworry,Iwon'ttellanyone:"}#...namespace:dbdodesc'Dumpremotedatabase'task:dumpdorun"mysqldump-u#{mysql_user}-p#{mysql_database}>~/#{mysql_database}.sql"do|channel,stream,data|ifdat

随机推荐