【问题标题】:Can't install @uirouter/angularjs via npm无法通过 npm 安装 @uirouter/angularjs
【发布时间】:2018-01-10 14:19:25
【问题描述】:

尝试通过 npm 安装@uirouter/angularjs,但出现以下错误:

npm ERR! code E404
npm ERR! 404 Not Found: @uirouter/angularjs@1.0.12
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/anatolyt/.npm/_logs/2018-01-10T14_14_22_375Z-debug.log

我正在使用 node v8.9.1 和 npm 5.6.0,我也在使用 nvm。使用 OSX High Sierra - 最新。

我的 package.json 文件如下:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "@uirouter/angularjs":"1.0.12"
  },
  "author": "",
  "license": "ISC"
}

【问题讨论】:

  • 你用了什么命令?
  • 我正在使用npm install

标签: angularjs npm angular-ui-router npm-install


【解决方案1】:

我怀疑它与我们的私有 npm 存储库有关 - sinopia,它无法解析以 @@uirouter/angularjs@angular/core 等开头的名称...

感谢我们的IT小哥,他在这个帖子里找到了解决方案:Unable to resolve dependencies like "@angular/common",你需要本地发布:

  • npm config set "@angular:registry" http://registry.npmjs.org/

这将导致 npm 绕过 sinopia 并直接进入 npmjs 存储库以获取 @angular 范围内的所有包。您必须对每个范围执行相同的操作。

另一个永久解决方案(尚未测试)是修改 sinopia 的代码: 在sinopia/lib/up-storage.js 更改第 10 行的代码

var encode  = function(thing) {
  return encodeURIComponent(thing).replace(/^%40/, '@');
};

【讨论】:

    猜你喜欢
    • 2016-06-14
    • 2017-12-10
    • 2011-09-01
    • 2013-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-12
    • 2017-03-28
    相关资源
    最近更新 更多