Can't install any package with node npm

前端 未结 16 1967
一向
一向 2020-12-02 13:12

I\'m trying to install some node packages through npm, but it won\'t go. I\'ve already tried to install/unistall/update node, but nothing seems to work.

I\'m using u

相关标签:
16条回答
  • 2020-12-02 13:30
    npm install <packagename> --registry http://registry.npmjs.org/
    

    Try specifying the registry with the install command. Solved my problem.

    0 讨论(0)
  • 2020-12-02 13:34

    I had this issue, and doing npm cache clean solved it.

    0 讨论(0)
  • 2020-12-02 13:34

    I also had problem in Ubuntu 15.10 while installing gulp-preetify.

    The problem was:

    1. Registry returned 404 for GET on http://registry.npmjs.org/gulp-preetify

    2. I tried by using npm install gulp-preetify but it didn't worked.

    3. Again i tried using: npm i gulp-preetify and it just got installed.

    I cannot guarantee that it will solve your problem but it won't harm with a single try.

    0 讨论(0)
  • 2020-12-02 13:38

    Following on from LAXIT KUMAR's recommendation, we've found that at times the registry URL can get corrupted, not sure how this is happening, however to cure, just reset it:

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

    The 404 disappeared as it was going to the correct location again.

    0 讨论(0)
  • 2020-12-02 13:39

    Translated:

    It happened the same to me and in my case in particular was because the package.json was wrong. example:

    {
       "name": "app",
       "version": "0.0.0",
       "description": "any description",
       "main": "index.js",
       "author": "me", ->wrong
    }
    

    The last comma was left over and it gave me error any instalacción with npm in this proyect

    then:

    {
       "name": "app",
       "version": "0.0.0",
       "description": "any description",
       "main": "index.js",
       "author": "me"
    }
    

    I hope it will help.

    0 讨论(0)
  • 2020-12-02 13:40

    If anyone is specifically getting Unexpected token <, and your package.json is fine, check your npm-shrinkwrap.json file! I had unresolved merge issues in mine, and fixing that resolved everything.

    0 讨论(0)
提交回复
热议问题