【问题标题】:npm install failing with 404 error (/@fortawesome%2fpro-regular-svg-icons - Not found) althoug token is setnpm install 失败并出现 404 错误(/@fortawesome%2fpro-regular-svg-icons - 未找到)尽管设置了标记
【发布时间】:2021-11-16 21:54:46
【问题描述】:

修复此link中未找到的私有包失败后。

我遇到了错误 ```font awesome`` library not found。以下是错误消息的详细信息:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@fortawesome%2fpro-regular-svg-icons - Not found
npm ERR! 404 
npm ERR! 404  '@fortawesome/pro-regular-svg-icons@^5.15.2' 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 'data-qa-frontend'
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!     /home/rando/.npm/_logs/2021-09-23T12_59_34_988Z-debug.log

如果我为字体真棒注册表添加 auth_token,如下所示:

//registry.npmjs.com/:_authToken={TOKEN}
@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken={TOKEN}

由于找不到私有包而失败。删除 font-awesome 注册表时会抛出 font-awesome library not found 的错误。

下面是部分 package.json 文件:

{
  "name": "project-name",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@org/private-package": "^0.1.24",
    "@fortawesome/fontawesome-pro": "^5.15.3",
    "@fortawesome/fontawesome-svg-core": "^1.2.34",
    "@fortawesome/pro-duotone-svg-icons": "^5.15.2",
    "@fortawesome/pro-light-svg-icons": "^5.15.2",
    "@fortawesome/pro-regular-svg-icons": "^5.15.2",
    "@fortawesome/pro-solid-svg-icons": "^5.15.2",
    "@fortawesome/react-fontawesome": "^0.1.14",

提前谢谢你。对于解决此问题的任何帮助,我将不胜感激。

【问题讨论】:

    标签: node.js ubuntu npm


    【解决方案1】:

    经过多次试验,

    我按照以下步骤解决了这个问题:

    1. 修改.npmrc文件,使其内容如下:
    @fortawesome:registry=https://npm.fontawesome.com/
    //npm.fontawesome.com/:_authToken={TOKEN}
    
    1. 转到终端并登录到 npm,如下所示:
    npm login
    Username:
    Password:
    Email: (this IS public) {may email}
    Logged in as {my username} on https://registry.npmjs.com/.
    

    检查.npmrc file后,它应该如下所示:

    @fortawesome:registry=https://npm.fontawesome.com/
    //npm.fontawesome.com/:_authToken={TOKEN}
    //registry.npmjs.org/:_authToken=npm_{TOKEN}
    
    1. 最后在项目根目录下运行 npm install 即可成功完成。

    【讨论】:

      猜你喜欢
      • 2022-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-03
      • 1970-01-01
      • 2011-12-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多