Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] When using Docker image, installing package globally is hanging #7686

Open
2 tasks done
cmerat opened this issue Jul 24, 2024 · 3 comments
Open
2 tasks done

[BUG] When using Docker image, installing package globally is hanging #7686

cmerat opened this issue Jul 24, 2024 · 3 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@cmerat
Copy link

cmerat commented Jul 24, 2024

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When installing a package globally, the installation "hangs" after "fetch/packumentCache" steps for minutes before proceeding and completing with a bunch of "placeDep" steps. This behavior started happening approximately two months ago and has continued since. This is making building the container images for my app very slow (5+ mins).
npm-install.log

Expected Behavior

The installation should not hang or, at the very least, give me feedback on what is taking so long.

Steps To Reproduce

  1. docker run -it --rm --entrypoint /bin/sh node:20-alpine
  2. npm i -g --verbose vite

Environment

  • npm: 10.8.2
  • Node.js: 20.12.2
  • OS Name: Alping Linux
  • System Model Name: Docker Desktop
  • npm config:
; node bin location = /usr/local/bin/node
; node version = v20.12.2
; npm local prefix = /
; npm version = 10.8.2
; cwd = /
; HOME = /root
; Run `npm config ls -l` to show all defaults.
@cmerat cmerat added Bug thing that needs fixing Needs Triage needs review for next steps labels Jul 24, 2024
@milaninfy
Copy link
Contributor

milaninfy commented Jul 30, 2024

@cmerat The installation is not completing or it's taking time ?
Based on your logs it looks like installation was complete, also time taken by installation depends on various factors like network speed and computing resources. you can use log level silly for even more logs. I did try the the steps in docker node alpine and it worked fine.

@cmerat
Copy link
Author

cmerat commented Jul 30, 2024

@milaninfy it eventually completes, usually taking between 5 and 10 minutes. A few months ago, it would complete in seconds. Not sure what is going on and the logs aren't verbose enough (even with silly level logging) to give me enough information. Would really love the log to have timestamps, too. Would really help with figuring out where it's hanging.

I could be completely wrong, but from verbose logging I see in the shell, it's somewhere between lines 210 and 256 since the delay is between those two verbose lines being output to console. Lines here are file number lines, not the logging index at the start of each line.

@fuhlich
Copy link

fuhlich commented Aug 27, 2024

There is a problem with npm install since node 20 #nodejs/docker-node#1946
It only affects images that use musl as c lib, alpine is among them. The root cause seems to come from qemu which is used by docker https://gitlab.com/qemu-project/qemu/-/issues/1729. The issue is stalling at the qemu project,
Apparently, there was a change in npm with node 20 that hits the qemu bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests

3 participants