Robert Dinaro
Robert Dinaro

Reputation: 538

Unable to install @angular/common/http using npm

Until yesterday, I was able to download @angular/common/http package. However starting from today, every time I issue

npm i

command, I get the following error:

npm ERR! code EINVALIDPACKAGENAME npm ERR! Invalid package name "@angular/common/http": name can only contain URL- friendly characters

People have suggested to upgrade/downgrade npm which I have tried but no luck so far.

package.json

"dependencies": {
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/common/http": "^5.0.0",

Any ideas guys? let me know if you need more info.

Thanks

Upvotes: 10

Views: 19312

Answers (1)

mast3rd3mon
mast3rd3mon

Reputation: 8835

The @angular/common/http module is part of the @angular/common module. You only need to include @angular/common within your dependencies, not the http module as well.

Adding @angular/common/http to your package json will try to include it a second time when you already have it. Remove it, delete your node_modules folder and rerun npm install

Upvotes: 22

Related Questions