无法通过npm安装@ uirouter / angularjs

时间:2022-08-24 07:26:19

Trying to install @uirouter/angularjs via npm, but getting the following error:

尝试通过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

I'm using node v8.9.1 and npm 5.6.0, I'm using nvm too. Using OSX High Sierra - latest.

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

My package.json file is as following:

我的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"
}

1 个解决方案

#1


0  

As I suspected it was related to our private npm repository - sinopia, it was unable to resolve name which begins from @, @uirouter/angularjs, @angular/core, etc...

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

Thanks for our IT guy, he found a solution in this thread: Unable to resolve dependencies like "@angular/common", you need to issue locally:

感谢我们的IT人员,他在这个帖子中找到了一个解决方案:无法解决像“@ angular / common”这样的依赖关系,你需要在本地发布:

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

it will cause npm to bypass sinopia and go straight to the npmjs repository for all packages within @angular scope. You have to perform same for every scope.

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

Another permanent solution (untested yet) is to modify sinopia's code: in sinopia/lib/up-storage.js change code on line number 10

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

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

#1


0  

As I suspected it was related to our private npm repository - sinopia, it was unable to resolve name which begins from @, @uirouter/angularjs, @angular/core, etc...

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

Thanks for our IT guy, he found a solution in this thread: Unable to resolve dependencies like "@angular/common", you need to issue locally:

感谢我们的IT人员,他在这个帖子中找到了一个解决方案:无法解决像“@ angular / common”这样的依赖关系,你需要在本地发布:

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

it will cause npm to bypass sinopia and go straight to the npmjs repository for all packages within @angular scope. You have to perform same for every scope.

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

Another permanent solution (untested yet) is to modify sinopia's code: in sinopia/lib/up-storage.js change code on line number 10

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

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