【发布时间】:2021-09-22 17:59:58
【问题描述】:
我在 npm 上创建了一个私有包并安装在本地,它工作正常。在使用 GitLab CICD 部署项目期间。我收到此错误。为了解决这个问题,我在构建中创建了一个.npmrc 文件,其中访问令牌为。
脚本:
whoami
echo $PATH
source /etc/environment
echo '//registry.npmjs.org/:_authToken=<MY_AUTH_TOKEN>'>.npmrc
npm whoami
npm i
错误:
npm ERR! code E404
npm ERR! 404 Not Found - GET
https://registry.npmjs.org/@<MY_ORG>/<PRIVATE_PACKAGE_NAME>/-/<PRIVATE_PACKAGE_NAME>-1.0.1.tgz
npm ERR! 404
npm ERR! 404 '@<MY_ORG>/<PRIVATE_PACKAGE_NAME>@1.0.1' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'app'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-09-22T17_46_52_727Z-debug.log
请帮我解决这个问题。
【问题讨论】:
-
npm whoami是否返回预期结果?