【问题标题】:npm ERR! 404 Not Found for Private Package while installing on gitLab CICDnpm 错误!在 gitLab CICD 上安装时找不到私有包的 404
【发布时间】: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 是否返回预期结果?

标签: node.js npm cicd


【解决方案1】:

仔细检查您的 npm 令牌。在您的 npm 帐户配置文件中。

每个npm logout 实际上都会从您的帐户中删除令牌。 (存储在您机器上的全局 .npmrc 中)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-07
    • 2021-04-03
    • 2022-08-10
    • 1970-01-01
    • 2021-11-04
    • 1970-01-01
    相关资源
    最近更新 更多