npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.46k stars 3.15k forks source link

[BUG] npm install will randomly hang forever and cannot be closed when this occurs #4028

Open Metritutus opened 2 years ago

Metritutus commented 2 years ago

Is there an existing issue for this?

This issue exists in the latest npm version

Current Behavior

When running npm install it will sometimes hang at a random point. When it does this, it is stuck forever. CTRL+C will do nothing the first time that combination is pressed when this has occurred. Pressing that key combination the second time will make the current line (the one showing the little progress bar) disappear but that's it. No further responses to that key combination are observed.

The CMD (or Powershell) window cannot be closed regardless. The process cannot be killed by Task Manager either (Access Denied, although I'm an Administrator user so I'd assume the real reason is something non-permissions related). The only way I have found to close it is to reboot the machine.

My suspicion is it's some sort of deadlock, but this is a guess and I have no idea how to further investigate this. I've tried using Process Explorer to check for handles to files in the project directory from other processes but there are none. There are handles held by the Node process npm is using, and one for the CMD window hosting it, but that's it.

Even running with log-level silly yields no useful information. When it freezes there are no warnings or errors, it just sits on the line it was on. This is some log output from one of the times when it got stuck (I should again emphasise that the point where it gets stuck seems to be random, so the last line shown here isn't always the one it freezes on):

npm timing auditReport:init Completed in 49242ms
npm timing reify:audit Completed in 55729ms
npm timing reifyNode:node_modules/selenium-webdriver Completed in 54728ms
npm timing reifyNode:node_modules/regenerate-unicode-properties Completed in 55637ms
npm timing reifyNode:node_modules/ajv-formats/node_modules/ajv Completed in 56497ms
npm timing reifyNode:node_modules/@angular-devkit/schematics/node_modules/ajv Completed in 56472ms
[##################] \ reify:ajv: timing reifyNode:node_modules/@angular-devkit/schematics/node_modules/ajv Completed in 564

The only thing that I can think of right now is that Bit Defender (the only other application running) is interfering somehow, however it's the one application I can't turn off.

I've seen this issue occur on different projects, on different network and internet connections, and on different machines. Does anyone have any advice on how to investigate this, or at the very least a way to kill the process when it hangs like this without having to reboot the machine? Being forced to reboot when this issue occurs is perhaps the most frustrating thing in all of this.

Expected Behavior

npm install should either succeed or show an error. If it gets stuck it should either time-out or be closable by the user.

Steps To Reproduce

  1. Clear down the node_modules folder (ie with something like rmdir /q /s)
  2. Run. npm install
  3. Watch and wait.
  4. If it succeeds, repeat the above steps until the freeze is observed.

Environment

prefix = "C:\Users\\AppData\Roaming\npm"

; "user" config from C:\Users\.npmrc

//pkgs.dev.azure.com//_packaging//npm/registry/:_authToken = (protected)

; node bin location = C:\Program Files\nodejs\node.exe ; cwd = C:\Users\ ; HOME = C:\Users\ ; Run npm config ls -l to show all defaults.

Bizzle-Dapp commented 2 years ago

If there was ever a linked example on "How to report an issue", this would probably be it.

LegendaryMediaTV commented 2 years ago

I was getting this error last night. It seemed as though all NPM operations were going slow and/or hanging. I tried reinstalling Node/NPM/etc. Not sure if it's related, but last night I also noticed that the NPM site was taking a while to pull up.

It finally seemed to clear itself up about an hour ago and everything has been working for me since. I'm guessing it was something server-side, though NPM's status page doesn't show anything as of yet.

Metritutus commented 2 years ago

I was getting this error last night. It seemed as though all NPM operations were going slow and/or hanging. I tried reinstalling Node/NPM/etc. Not sure if it's related, but last night I also noticed that the NPM site was taking a while to pull up.

It finally seemed to clear itself up about an hour ago and everything has been working for me since. I'm guessing it was something server-side, though NPM's status page doesn't show anything as of yet.

I'm not sure if that's the same thing. If it were network connection related, I'd assume it would time out at some point. I'd certainly expect to be able to cancel out of the process.

LegendaryMediaTV commented 2 years ago

I'm not sure if that's the same thing. If it were network connection related, I'd assume it would time out at some point. I'd certainly expect to be able to cancel out of the process.

I would have expected a network connection timeout too, but I waited well over an hour (for things that normally take a minute or less) and the process just sat frozen with a partial progress bar. I was, however, able to cancel out of the process on Windows Terminal, which seems to be the only difference.

I even tried a different machine with a different version of Node/NPM (on a different network in a different city) during that time and it had similar issues (i.e., taking a couple minutes to run npm outdated which normally takes a few seconds), but I didn't actually try an install.

danmana commented 2 years ago

I've been having the same problem once in a while: npm install is stuck and I can't cancel the process.

For the last few months, this happened rarely, and when it happened I had to restart my laptop to get it working again.

Last week I updated Node from 14 to 16, and npm from 6 to 8. Everything seemed fine until today...

However, today I can't get npm install to finish, not even once. I've tried restarting my laptop about a dozen times, but it doesn't help. I've tried npm cache clear --force and deleting node_modules - nothing helps.

I tried npm install --verbose, but I don't get any more info than this:

npm http fetch GET 200 https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz 38952ms (cache miss)
npm timing reifyNode:node_modules/@sealsystems/mongo/node_modules/@types/lodash Completed in 45927ms
npm timing reifyNode:node_modules/@sealsystems/assert-mongo-error/node_modules/@types/lodash Completed in 45946ms

Note: it's not always the same dependency that it gets stuck at.

What I've found that seems strange is that as it fetches dependencies it starts getting progressively slower, until it gets stuck (when the timing gets about 30-45 seconds). Here are some lines from the logs (the lines are in order, but I skipped a lot of them in between)

npm http fetch GET 200 https://registry.npmjs.org/figures 216ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz 6802ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz 9951ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz 11129ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz 18008ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@types/stringify-object/-/stringify-object-3.3.0.tgz 26988ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz 38952ms (cache miss)

Maybe relevant - I have a few private scoped packages configured in npmrc

@myprivatescope:registry = "https://npm.pkg.github.com/"
//npm.pkg.github.com/:_authToken=ghp_***

though it doesn't seem to get stuck on them

npm http fetch GET 200 https://npm.pkg.github.com/@myprivatescope%2fconsul 515ms (cache miss)

I've tried setting npm config set registry http://registry.npmjs.org/, it seems to move a bit faster in the beginning, but still ends up stuck.

It seems today is not a good day for developing 😢

Windows 10 21H1 build 19043.1348 Node: v16.13.0 NPM: tried with 8.1.3, 8.1.4, 7.19.1 none work Bitdefender Endpoint Security tools 7.2.2.101 (not sure if this is the issue)

Edit: tried uninstalling node completely, cleaning everything up and reinstalling, but it didn't work ... still stuck

danmana commented 2 years ago

After trying all day to reinstall and make npm work I ended up:

  1. installing Ubuntu WSL
  2. installing node in ubuntu
  3. Copying my settings to ~/.npmrc

This actually worked, although slowly, it never got stuck npm timing reify Completed in 315565ms

I have no idea why even after purging every reference to node or npm from my laptop and doing a fresh install, it still didn't work on Windows.

CFT-Chris commented 2 years ago

I've been running into this as well. Happens on reifyNode in the npm output.

npm is latest version (8.3) platform is ubuntu 21.10

I did just recently update from npm 6.x to latest. One thing I note is the warning message saying package-lock.json is out of date and needs to be rewritten (one-time operation).

For smaller projects, it squeaks by but only after many periods of CPU lock ups and spending more time than it used to with npm version 6.x.

For bigger projects, the only new observation I can add is that the number of node processes running simultaneously explodes, and they are all hogging the CPU and memory. So now memory swap processes enter the mix and the whole computer grinds to a halt.

Eventually I have to killall node if the computer isn't completely locked up, otherwise I have to do a hard reset. I still haven't succeeded to complete the "npm install" on larger projects.

bernwong commented 2 years ago

I'm having a similar issue after upgrading to node 16.13.1 and npm 8.3.0 (running on centos 7) As others have mentioned, "npm install" gets progressively slower on the fetches to a point where it completely hangs.

After I downgraded npm back to version 6.14.15 ( npm install -g npm@6 ), the "npm install" completes quickly and successfully.

CFT-Chris commented 2 years ago

With 8.3.0, I got by installing all the dependencies of my larger projects by running npm install in small subsets of said dependencies, until all were installed.

It appears if you try to install multiple large dependencies at once, there is a greater probability of parallel npm install processes of the subdependencies causing an out-of-memory condition on the computer, which I eventually had to kill in order to gain control of the computer again.

tekumara commented 2 years ago

In my case it was network related. I had a private registry in npm config and I wasn't on the VPN to access it.

darkartswizard commented 2 years ago

Seeing this as well on a Mac. Might be network dropouts. EDIT: Downgraded to 6.14.15 Restarted machine, cleared cache, removed all packages, deleted node_modules, deleted package-lock. Then we started putting Dependancies and devDependancies packages back a few at a time. Eventually got it to build without error.

begroff commented 2 years ago

I am getting this error as well on a windows PC using the command prompt (cmd.exe). I've tried the following combinations and was able to reproduce the stuckness each time (I was using nvm for windows to switch versions):

node v16.13.1 / npm 8.1.2 node v17.2.0 / npm 8.1.4 node 16.10.0 / npm 7.24.0

I do have AV Defender installed, which I can't disable due to it being a company installed anti-virus software. I was also running Fiddler4 and haven't seen any HTTP errors related.

I then switched to a git bash terminal and was able to run npm install 3 times with version 16.13.1/8.1.2 and no hangs. I also ran npm ci 3 times with no hangs.

My git version installed on windows was 2.17.1.windows.2.

darkartswizard commented 2 years ago

I'm documenting my adventures in npm. Never occurred to me to switch from ZSH to Bash or use Git Bash. Good post!

begroff commented 2 years ago

Thanks. I was also able to reproduce the stuckness using PowerShell too. Now if I could figure out how to get my azure pipeline to run git bash I'll be golden. I'm going to try to use the bash task https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/bash?view=azure-devops

begroff commented 2 years ago

In case anyone is having this issue when running azure pipelines with a self-hosted agent. Below is a solution that worked for me. The only requirement for the server/computer that is running the pipeline is to have git for windows installed so you can access the sh.exe

  - task: CmdLine@2
    displayName: Restore NPM Packages
    inputs:
      script: '"C:\Program Files\Git\bin\sh.exe" --login -c "npm ci"'
      workingDirectory: '' # Directory location where the package.json file is 
      failOnStderr: false
    timeoutInMinutes: 15
stacy-rendall commented 2 years ago

I have also been seeing this issue since NPM 8 (initially on Node.js 14 and more recently on Node.js 16), Windows 10

It is kind of intermittent, seems to happen more frequently on Bash (from Git for Windows) than PowerShell or CMD

The only workaround I have been able to identify is a complete restart of the system, manually delete node_modules and package-lock.json then run npm i

CFT-Chris commented 2 years ago

I've found the reason and a workaround for my particular scenario. In my case, I had a dependency on a package from a git repo, which also had a git repo dependency, and it set off an npm install fork bomb, causing out of memory conditions on my machine.

I've logged the specific bug, proposed solution and workaround here: https://github.com/npm/pacote/issues/127#issue-1155772041

jumpmouse commented 2 years ago

I have this problem for a while now. I thought it that was some problem with my project's node_modules or npm version mismatch problem.

Just now, I tried to install one package globally, and encountered exact same problem. nodejs 14.18.1 npm 8.1.4

not sure if this helps: with -verbose enabled, this is what I've noticed:

And this is only one package (bigger one, with dependencies). I've tried with next random one, same thing.

ljharb commented 2 years ago

@jumpmouse npm 8.1.4 is very old; can you try with v8.5.3?

jumpmouse commented 2 years ago

@ljharb thanks, I've updated to 8.5.3

Unfortunately, same behavior. This time I've tried npm i on my medium size Angular project (removed node_modules and cleared cache).

It runs fast, then slows down and freezes. if I terminate (Ctrl+C) process on freeze and start again, it freezes on same spot. if I wait forever, it freezes on same line and then on couple more. Each freeze lasts for 2-3 minutes. Eventually, instalation finishes (after about 7-8 minutes).

darkartswizard commented 2 years ago

I've had no issue since posting. I was able to narrow down one issue an old wdio and current webdriverio package installed. I removed the sync (fibers) package as well. Then I used ncu to find conflicting package versions. Then ncu -u to update the package. Followed by npm i to create the package-lock. Aside from an occasional unexplained issue with a port-in-use package, my Mac has been relatively stable ever since. Hope this helps.

rayeaster commented 2 years ago

I am getting this error as well on a windows PC using the command prompt (cmd.exe). I've tried the following combinations and was able to reproduce the stuckness each time (I was using nvm for windows to switch versions):

node v16.13.1 / npm 8.1.2 node v17.2.0 / npm 8.1.4 node 16.10.0 / npm 7.24.0

I do have AV Defender installed, which I can't disable due to it being a company installed anti-virus software. I was also running Fiddler4 and haven't seen any HTTP errors related.

I then switched to a git bash terminal and was able to run npm install 3 times with version 16.13.1/8.1.2 and no hangs. I also ran npm ci 3 times with no hangs.

My git version installed on windows was 2.17.1.windows.2.

similar issue on windows10 and took nearly more than one hour to complete

$ node --version
v16.13.2

$ npm --version
8.1.2

...npm timing npm Completed in 4213666ms...
robertwbradford commented 2 years ago

We have multiple developers in our org (mostly on Macs) also seeing issues like this after going to Node 16. npm ci seems to be especially problematic, but we have noticed it in other commands as well. For example, in one project (a lerna monorepo) we have a "setup" script that runs npm ci and then some various lerna execs. It has got to the point where no one can run it anymore. It just freezes the whole machine and we have to do a hard restart. If you view the "Activity Monitor" while its going, there doesn't seem to be any indication of a problem. The machine just stop responding. Not sure how to even debug this.

adipascu commented 2 years ago

I think this is a duplicate of #3078, the fix for this was released in npm v8.6.0

batressc commented 2 years ago

In my experience, this behavior ocurrs when execute npm install or npm uninstall in a windows console that not is maximized (cmd, powershell, nodejs command prompt, etc.). I don't know why ocurrs this error, but if we can maximize terminals before execute these commands we can avoid the freezing behavior.

I hope this can help you guys.

Best regards from El Salvador.

robertwbradford commented 2 years ago

npm@8.6.0 did not solve this for us :(

leoNavarro95 commented 2 years ago

I am getting this error as well on a windows PC using the command prompt (cmd.exe). I've tried the following combinations and was able to reproduce the stuckness each time (I was using nvm for windows to switch versions):

node v16.13.1 / npm 8.1.2 node v17.2.0 / npm 8.1.4 node 16.10.0 / npm 7.24.0

I do have AV Defender installed, which I can't disable due to it being a company installed anti-virus software. I was also running Fiddler4 and haven't seen any HTTP errors related.

I then switched to a git bash terminal and was able to run npm install 3 times with version 16.13.1/8.1.2 and no hangs. I also ran npm ci 3 times with no hangs.

My git version installed on windows was 2.17.1.windows.2.

Thanks a lot to mention the git bash terminal solution this save me. I am also ran into this problem that the npm get stuck forever while running on the Windows 10 powershell. So I just ran the npm install in git bash and solved inmediately without any issue.

Now, I wonder why this happens. Please, if anyone knows, I would greatly appreciate it the explanation.

cyrusae commented 2 years ago

Having this issue on Mac OS 11.6 + Visual Studio Code terminal; Node v17.3.1, npm v8.1.3. If I interact with the terminal while it's frozen on a loading bar it will spawn another, identical loading bar beneath. This is happening when attempting to install packages and as far as I can tell (i.e. checking the rest of the project) there is no trace of an install having begun. It's consistently happening with sass-embedded, for some reason; the existence of an npm issue for the same thing made me figure I should come here.

Stradivario commented 2 years ago

I am really not happy that i have upgraded to the latest nodejs LTS :(

Having the same problem npm install stucks forever and it cannot be closed

It appears that problem is related with peerDependencies but i cannot connect the dots at the moment

Simple way to reproduce the bug

mkdir npm-bug
npm init
npm install @gapi/voyager

At the moment when we try to install this package @gapi/voyager it stucks and the terminal cannot be closed accept forcefully.

package @gapi/voyager depends on "graphql-voyager": "^1.0.0-rc.15" which has the following peer dependencies

  "peerDependencies": {
    "graphql": ">=14.0.0",
    "react": ">=15.4.2",
    "react-dom": ">=15.4.2"
  },

So by installing manually peer dependencies graphql, react, react-dom it appears that the package installs successfully.

Need to dive deep into which file is causing it but i think it is somehow related to this file in npm library signal-exit https://github.com/tapjs/signal-exit/blob/main/index.js

I don't really want to offend anyone but in signal-exit the code looks really imperative and is a bit of unpredictable and it is sad that i can see such a small packages can break the whole npm ecosystem. I think npm should not rely on any package at all and to be stand alone with no dependencies.

https://github.com/tapjs/signal-exit/blob/main/index.js#L142 Screenshot from 2022-04-16 14-26-40

The whole package signal-exit has a lot of var keywords the functions are mutating these variables we are dealing with events and you can guess what could go wrong :)

https://github.com/tapjs/signal-exit/blob/main/index.js#L156 Screenshot from 2022-04-16 14-30-52

This is unbelievable we have a filter on array and we are defining event handlers inside filter :-1:

The code is written before 7-8 years so i think at that moment we didn't had too much tools in the ecosystem

Someone may say what could go wrong :dancers:

node: v16.14.2 npm: v8.7.0 os: Ubuntu 20.04.4 LTS

billyromano commented 2 years ago

I’ve been noticing this issue for weeks now. It freezes my machine, hard restart multiple times a day and it’s random. I’ve noticed running the gulp conventional changelog task may be a culprit since I commented that out and never had issues on that project again. However, on a nextjs project today I ran ‘yarn add —dev eslint eslint-plugin-editorconfig’ and it froze at 2527/2681 progress. This issue is happening using yarn as well.

Update: hard restarted my machine and re-ran the yarn add command and it finished in 30 seconds. I noticed 3 different node processes show up in activity monitor when using yarn to install.

node v14.19.1 npm v8.6.0 yarn v1.22.17 iTerm2 macOS Big Sur 11.6.5

cscleison commented 2 years ago

Update: rewriting my whole comment with my new findings

node v18.1.0 npm 8.10.0 windows 10 21H1

It seems to be a matter of how many dependencies you have. Why? Because by doing npm ci --verbose --no-progress --no-color I started to find what packages were taking longer at the reify process and tried to isolate them by creating another package.json in a new folder. With that I created a small repro with only the slow ones:

npm i --no-progress --no-color auth0-lock@11.32.1 devexpress-dashboard@21.1.5 react-mentions@1.2.1 ramda@0.27.0 react-color@2.19.3 date-fns@2.23.0 lodash-es@4.17.21 react-mentions@1.2.1 react-dnd@2.5.4 date-fns-tz@1.1.6

and then you call

npm ci --verbose --no-progress --no-color

However with this small repro the installation does not hang! Some do take a bit during the reify but it finishes successfully. By removing these slow dependencies from my main package.json it makes the installation succeed (even tho a bit slow still)! This is why I think it might be a memory leak that requires a lot of dependencies to occur. This comment corroborates my theory

I will stick to npm 6 until a solution is found for this...

MykolaRodin commented 2 years ago

I met the similar issue when I installed nodejs v12.22.9 on Ubuntu 22.04 in WSL under Windows 11 Home. The installed npm had v8.5.1 version. Immediately after installation npm was present in /usr/bin but absent in /usr/local/bin. With that configuration I got failures when trying to install node-modules for basic Angular project.

Running sudo npm install -g npm --verbose helped me. After running this command npm version was upgraded to v.8.9.0, npm was added to /usr/local/bin and failures were eliminated.

treasuretron commented 2 years ago

having this issue on Fedora 34 with npm 6.14.16. I am able to control-c out of it though, doesn't lock up my machine. I tried removing proxy and npm config set registry http://registry.npmjs.org/, rebooted, no change.

Samuell1 commented 2 years ago

We had same issue it started hanging, getting stuck on rxjs package. Mostly we updated to nodejs 16 and npm to 8 and removed node-sass package and used sass and issues were solved. Not sure what was happening but it was nice friday.

FritzHerbers commented 2 years ago

Thought it hangs during download as it shows several minutes the following message [##################] - reify:rxjs: timing reifyNode:node_modules/rxjs Completed in 151764ms

But this is maybe the last package what was downloaded and further actions are running.

NPM should

flensrocker commented 2 years ago

For me, it works better with npm 8.9.0 (on Windows).

But I can confirm, that during npm ci --verbose the multiple "reify" messages get slower with each package.

tbruckmaier commented 2 years ago

We have experienced the same symptoms on node v14. Our problem was with a package which directly referenced a certain branch from github:

    "dependencies": {
        "package": "github:user/repo#master"
    }

Once we replaced that dependency with a regular version constraint, npm install / npm ci worked properly again:

    "dependencies": {
        "package": "^1.2.0"
    }

This might be a different issue, but since the log messages dont give any clue about the underlying problem, I have ended up in this issue as well. Maybe someone will find it useful.

monkbroc commented 2 years ago

I'm also experiencing the issue where a package that directly references a certain branch from github makes npm install hang. Switching from github:user/repo#branch to git+ssh://git@github.com/user/repo.git#branch works around the issue. This seems like a recent development (days or weeks).

david-mcafee commented 2 years ago

Also experiencing this issue when installing packages globally, and I've tried wiping everything out and starting over, with no success.

mmiretsky commented 2 years ago

I am also experiencing this issue. npm install hangs intermittently, forcing a reboot.

Windows 10 20H2 node v16.15.0 npm v8.11.0

Has this issue been triaged or investigated? It was opened over 6 months ago.

nlf commented 2 years ago

to summarize what i've learned from this thread to make sure i have a clear picture of what's going on here:

  1. this problem only occurs in windows
  2. the problem goes away when using bash
  3. the problem goes away when removing git based dependencies (or convincing npm to install git deps through ssh)

are any of you using a proxy? can you determine how many git dependencies are in your tree, and where they are hosted? (i.e. github, gitlab, etc..)

Dossar commented 2 years ago

So I also noticed node 16 hanging on installing a commit SHA, but it was fine when installing a tag version.

As an experiment I tried commit SHA install of a dependency present in several repositories. Note that I'm using MacOS Monterey (12.4) in this, not Windows which previous users have mentioned.

All these have prettier in their dependencies style-loader: https://github.com/webpack-contrib/style-loader less-loader: https://github.com/webpack-contrib/less-loader css-loader: https://github.com/webpack-contrib/css-loader

git clone git@github.com:webpack-contrib/style-loader.git
git clone git@github.com:webpack-contrib/less-loader.git
git clone git@github.com:webpack-contrib/css-loader.git

Using node v16.12.0 / npm v8.1.0 I did an npm i in each, one at a time.

After doing npm i in each of the above three repositories, I did the following in parallel (basically run this command in one, and while it's running do it in the other two as well)

npm install git+ssh://git@github.com:prettier/prettier.git#9c11aa141a69a04b5c23c6d3005a2330db778109

So it takes commit 9c11aa141a69a04b5c23c6d3005a2330db778109 from prettier, which is purposely not the most recent commit as of now -- rather it's just to have a specific commit different from main latest.

I did notice that node 16 hangs on this statement:

⸨⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⸩ ⠙ idealTree: timing arborist:ctor Completed in 1ms

Anyone else able to try this out?

stacy-rendall commented 2 years ago

to summarize what i've learned from this thread to make sure i have a clear picture of what's going on here:

1. this problem only occurs in windows

2. the problem goes away when using `bash`

3. the problem goes away when removing git based dependencies (or convincing npm to install git deps through ssh)

are any of you using a proxy? can you determine how many git dependencies are in your tree, and where they are hosted? (i.e. github, gitlab, etc..)

For whatever reason I haven't had the problem for a long time so cannot answer all your questions in great detail, but just from reviewing posts above plus my experience:

  1. no, from a quick scan people above have reported the issue on Fedora and Ubuntu as well
  2. no, I experienced the problem much more frequently with git-bash on Windows than with PowerShell or CMD
  3. no, I typically do not use git based dependencies, and from memory I do not believe I had git based dependencies in the projects that had the issue
  4. I don't use a proxy
monkbroc commented 2 years ago

I can reproduce the issue by building a Docker container from a Ubuntu Linux host (development machine or default CircleCI executor) using the following Dockerfile:

FROM node:14
WORKDIR /app
RUN npm install -ddd github:lodash/lodash

Run docker build . and the build hangs at the npm install command. The same command completes with FROM node:16.

prcdpr commented 2 years ago

Lately it happens every day on my computer (Win10, npm v8.11.0, node v16.15.1). This is truly very high priority issue as it happens on LTS version of NodeJS and can bring down whole computer until it's rebooted.

davedoesdev commented 2 years ago

Same as @monkbroc - on Node 14 only, npm hangs installing lodash. EDIT: It does come back after about 5 mins.

xpol commented 2 years ago

Met the same problem, when build with bamboo behind proxy. It sometimes can success, but sometimes need retry. But even for the success cases, it is take 7 minutes, far slower than npm 6 (only 2 minutes).

Alzy commented 2 years ago

I can confirm that this is still happening. I have been struggling with deploying a project to AWS Elastic Beanstalk using a library hosted in a private repo on bitbucket and it hangs the entire build step causing the environment to fail into a health level of "No data". Running the "top command I can see two instances of npm install running for some reason. I tried changing the package.json file as @monkbroc suggested and it still does not work.

mmiretsky commented 2 years ago

@nlf - you had asked for some more information about this issue and you received it. What is the next step?

CXCubeHD commented 2 years ago

I TRIED EVERYTHING ABOVE AND IT DID NOT WORK

I am so frustrated, did spend 10 hours trying to fix this once and for all. IT'S A SHAME that this bug STILL DOES exist. Every other build / project system (CMake, Dotnet, Deno) JUST WORKS, BUT THIS GARBAGE DOESN'T.

How hasn't this been fixed for more than 1 year? What idiots made this.

And because people will critize me for saying all this above, here are my logs: 2022-06-24T17_28_53_005Z-debug-0.log

This bug is affecting: npm install npm clean-install npm install npm@latest npm install other_package

Here is all what I tried:

I swear to god if this won't be fixed then I will never use ever use this garbage in my whole entire life. This isn't the first time this is happening.

Edit: I am using Pop!_OS as my distro if you are wondering.