cli icon indicating copy to clipboard operation
cli copied to clipboard

npm -v is super slow in my macbook

Open donggyu04 opened this issue 3 years ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

This issue exists in the latest npm version

  • [X] I am using the latest npm

Current Behavior

One day suddenly all npm commands became super slow. even just the npm -v takes 40 seconds! (node -v takes less than a second) I tried reinstalling but it didn't fine. do you have any advice or anyone with similar experience? thanks in advance.

Expected Behavior

npm -v to be finished in milliseconds

Steps To Reproduce

  1. In this environment...
  2. With this config...
  3. Run '...'
  4. See error...

Environment

  • npm: 8.5.5
  • Node.js: 16.15.1
  • OS Name: macOS Monterey 12.2 (M1)
  • System Model Name: Macbook Pro
  • npm config:
; "builtin" config from /opt/homebrew/lib/node_modules/npm/npmrc

prefix = "/opt/homebrew"

; node bin location = /opt/homebrew/Cellar/node@16/16.15.1/bin/node
; cwd = /Users/user
; HOME = /Users/user

donggyu04 avatar Jul 04 '22 14:07 donggyu04

The prefix generally shouldn’t be set, and node/npm shouldn’t be installed with homebrew - not sure if that’s the cause or not, but it’s worth a try.

ljharb avatar Jul 04 '22 15:07 ljharb

Try running npm --verbose -v as well and see what step takes long time. If everything looks OK there, something might be wrong with your system instead. Try dtruss npm -v and see where it spends most of its time.

victorb avatar Jul 06 '22 17:07 victorb

The prefix generally shouldn’t be set, and node/npm shouldn’t be installed with homebrew - not sure if that’s the cause or not, but it’s worth a try.

(unrelated to the issue opener but wanted to say thanks) @ljharb thank you so much! was searching around after a npm install took over 2hrs just to deliver a timeout message. Fact was I installed node via homebrew, and somehow it became slower and slower by the week.

vincentneo avatar Jul 12 '22 10:07 vincentneo

I installed node via homebrew, and somehow it became slower and slower by the week

is this what happened with you as well @donggyu04? sounds like this is maybe a packaging issue in homebrew, but we can sure look into it. did anyone happen to capture a full debug log for a slow run? that would be really helpful for us.

nlf avatar Jul 13 '22 22:07 nlf

@nlf sorry I didn't capture any debug log

vincentneo avatar Jul 14 '22 04:07 vincentneo