How to fix timeout for packages on `npm install`?

后端 未结 6 1162
南旧
南旧 2021-01-17 19:20

When I run npm install it seems to work fine until part way installing packages. It seems to have no problem with the first half, but then after a while it will

相关标签:
6条回答
  • 2021-01-17 19:42
    npm cache clean --force
    
    npm install --force
    

    It works fine.

    0 讨论(0)
  • 2021-01-17 19:48

    If it's about the timing problem you should find a speed solutions for npm install.

    So you can try these faster command than npm install :

    pnpm install %70 faster
    or
    npm install --no-audit 15% faster
    or
    npm install --prefer-offline --no-audit 15% faster

    check this article for details : speeding up npm install

    0 讨论(0)
  • 2021-01-17 19:48

    I solved the timeout issue by executing these commands:

    rm package-lock.json
    npm i
    
    0 讨论(0)
  • 2021-01-17 19:53

    It might not be your case, but I had issues with a package being hosted at github with the repo url being only with git protocol (port 9418 not usually open on firewall).

    Once added that to the firewall I could npm install without issues.

    You can view the repository url with:

    $ npm view zone.js repository.url
    git://github.com/angular/angular.git
    
    0 讨论(0)
  • 2021-01-17 19:58
    //npm config ls -l
    // add these 2 lines in .npmrc
    fetch-retry-maxtimeout = 6000000
    fetch-retry-mintimeout = 1000000
    
    //Siddharth Singh
    
    0 讨论(0)
  • 2021-01-17 20:03

    If it's still relevant or maybe for other people of interest: For me it helped, deleting the package.lock file and running npm cache clean --force.

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