xero xero - 6 months ago 11
Node.js Question

Npm throws 'must have a URL that starts with http: or https:' when installing @angular2-material packages

I'm installing @angular2-material/core ( or any other module ) with npm wont let me install any of the modules.

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "@angular2-material/core"
npm ERR! node v5.11.1
npm ERR! npm v3.8.6

npm ERR! must have a URL that starts with http: or https:
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>

I've tried :

npm set registry https://registry.npmjs.org/ // https


npm set registry http://registry.npmjs.org/ // http

But It wont work , I raised the issue with material guys but they're saying this is my local issue .

This is really killing me , there is no clue how to fix it at all.



This is mainly because you've tried multiple registries and now npm is kind of confused , You need to open your .npmrc and remove unnecessary registry paths.

To find your .npmrc :

     npm config ls -l | grep config

You will see something like :

     userconfig /Users/Yourname/.npmrc      

Then open that file with your editor and edit and remove extra unnecessary registries .