简体   繁体   中英

Can't install @uirouter/angularjs via npm

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

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.

My package.json file is as following:

{
  "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"
}

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...

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

  • 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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM