npm -v is super slow in my macbook
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
- In this environment...
- With this config...
- Run '...'
- 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
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.
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.
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.
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 sorry I didn't capture any debug log