authentication - npm login --always-auth doesn't add the appropriate entry to the config
问题描述
I use npm version 6.13.7 and Artifactory repository manager. The registry URL is defined in .npmrc
in my project folder:
root@2892c246217b:/build# cat .npmrc
registry=https://<masked>/artifactory/api/npm/<masked>
I want to use an authentication token created via npm login
command:
root@2892c246217b:/build# npm login --always-auth
Username: <masked>
Password:
Email: (this IS public) <masked>
Logged in as <masked> on https://<masked>/artifactory/api/npm/<masked>.
Now an install should work, however it doesn't:
root@2892c246217b:/build# npm install
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="Artifactory Realm"
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-02-04T17_28_52_957Z-debug.log
I check /root/.npmrc/
and see that always-auth
entry is missing. So I add it via npm config
:
root@2892c246217b:/build# npm config set always-auth true
And fetching works fine:
root@2892c246217b:/build# npm --verbose install
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli '--verbose',
npm verb cli 'install' ]
npm info using npm@6.13.7
npm info using node@v10.18.0
npm verb npm-session fd8f804800679bcc
npm info lifecycle <masked>@2.0.0~preinstall: <masked>@2.0.0
npm timing stage:loadCurrentTree Completed in 10ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 4ms
npm http fetch GET 200 https://<masked>/artifactory/api/npm/<masked>/<masked> 109ms
npm http fetch GET 200 https://<masked>/artifactory/api/npm/<masked>/<masked> 149ms
npm http fetch GET 200 https://<masked>/artifactory/api/npm/<masked>/<masked>/-/<masked>.tgz 46ms
npm http fetch GET 200 https://<masked>/artifactory/api/npm/<masked>/<masked> 309ms
npm http fetch GET 200 https://<masked>/artifactory/api/npm/<masked>/<masked> 738ms
...
Is that a bug in npm
or am I just doing something wrong?
解决方案
推荐阅读
- angular - 使用公共类来保存静态数据
- python - Tensorflow 2.0 中的 `Tensor`(相对于 `EagerTensor`)有什么用处?
- ubuntu - 如何修复:“blockUI blockOverlay 用半透明覆盖覆盖我的屏幕 - 无法点击”
- node.js - apollo graphql 查询上传的文件
- ruby-on-rails - 如何通过与条件的关系添加 has_one?
- javascript - 如何检查浏览器是否基于 Chromium?
- angular - 在 Angular 中覆盖组件时在模板中进行更改
- r - 如何在 R 中编辑我的数据框(多列)?
- python - 如何从 Excel 文件中导入行作为 Python 中的列表?
- swift - How to test for undefined array?