10

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

1 Answer 1

22

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

Sign up to request clarification or add additional context in comments.

3 Comments

sweet - you have saved me from hours of misery. Already invested couple of hours pulling my hair. And what you said makes sense. I just tried and it did work. Thanks a million.
this saved me, I was updating an older app with angular 2 and @angular/platform-browser-dynamic/animations was causing the same issues, removing it fixed the install
@JKing glad this answer could help you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.