npm / cli

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

npm stuck too long on apple new m1 computer #2306

Closed fengtaijun0507 closed 3 years ago

fengtaijun0507 commented 3 years ago

Current Behavior:

Stuck at "reify:rxjs: timing reifyNode:node_modules/@vue/cli/node_modules/typescript Completed in 3254ms"! No any feedback!

image

Expected Behavior:

install successfully!

Steps To Reproduce:

npm install -g @vue/cli

Environment:

AnnatarHe commented 3 years ago

image

stuck here more than 1 hour

and the task manager shows that node-pre-gyp is running: image

Environment: Device name Anton Processor AMD Ryzen 7 1700 Eight-Core Processor 3.00 GHz Installed RAM 32.0 GB Edition Windows 10 Pro Version 20H2 Installed on ‎2020/‎10/‎21 OS build 19042.685 Experience Windows Feature Experience Pack 120.2212.551.0 Node: v15.3.0 npm: 7.0.14

darcyclarke commented 3 years ago

@fengtaijun0507 we've made significant improvements & fixed a number of bugs since you first filed this, can you try installing the latest v7 & trying to reproduce this? (ie. npm i -g npm@7)

agustinguerra commented 3 years ago

I'm having the same issue, stuck at:

eify:rxjs: timing reifyNode:node_modules/@vue/cli/node_modules/typescript Completed in 3542ms

lnabergoi commented 3 years ago

Same issue image

chalkygames123 commented 3 years ago

This is probably due to Node Sass v4 and not relevant to M1.

By running npm install node-sass@4 --verbose on Node v15, I got the following:

...
npm info run node-sass@4.14.1 postinstall node_modules/node-sass node scripts/build.js
npm info run node-sass@4.14.1 postinstall { code: 0, signal: null }
npm timing build:run:postinstall:node_modules/node-sass Completed in 221308ms
...

It always takes a few minutes.

Polarts commented 3 years ago

Having the exact same issue here on Termux, thought it would be due to ARM processors but seems like it also happens on x64... Did anyone manage to fix the issue?

abale commented 3 years ago

Check if your working directory has a LOT of files in it (or a subfolder...) we just had the same issue in prod with a ~1M file subdirectory and it was crashing NPM after ~500S and hitting 4GB of heap.

j-ackk commented 3 years ago

Not sure if this is helpful or not; I had the same problem and my npm would break every time I tried to run npm install on a vue.js project. The problem seemed to be the recent version of Node.js (16.0.0). After uninstalling node and reinstalling version 14.16.1, it seemed to fix my problems.

Environment: OS: macOS Big Sur 11.0 Node: 14.16.1 npm: 7.11.2

andreibsk commented 3 years ago

Me, two of my coworkers, and our build server are also experiencing this "freeze". This started happening after we upgraded npm to v7 (by node 16). We are all on Windows 10 with latest updates installed. I tried the same list of packages on my personal PC and couldn't reproduce this. Which lead me to discover that the antivirus on our work machines is a factor in this freeze; I uninstalled it temporarily and the freeze didn't occur anymore. However this was not an issue with npm v6 and same version of AV (Bitdefender Endpoint Security Tools). Noteworthy might also be that once the freeze happens a node process remains active, even if the terminal is closed, and this process can't be killed - Task Manager gives an "Access denied" error. Also one or a few files in the node_modules folder remain open and locked by this process.

Environment: OS: Windows 10 Node: 16.0.0 and 16.1.0 npm: 7.11.2

lazydevleo commented 3 years ago

Any Fixes for this ?

imprfekt commented 3 years ago

The problem is the incompatibility between your Node version and node-sass. The problem was gone as soon as I downgraded from 16 to 14.x

jamesmalin commented 3 years ago

The problem is the incompatibility between your Node version and node-sass. The problem was gone as soon as I downgraded from 16 to 14.x

I downgraded as well for the time being.

Edit: Forgot to add here. A couple of min after posting I got everything working and up to date by installing with yarn (node 16.4). I was also missing a few dependencies for expo.

chalkygames123 commented 3 years ago

Node Sass with Node 16 support has been released. I haven't tried, but it possibly fixes the issue. https://github.com/sass/node-sass/releases/tag/v6.0.0

guiliredu commented 3 years ago

Downgrading to node v14 resolved the problem here.

$ npm install -g n
$ n v14
wraithgar commented 3 years ago

Thank you for the detailed info on node-sass and node versions.

@vue/cli@latest does not install node-sass unless I'm missing something.

~/D/n/scratch $ npm ls @vue/cli
scratch@1.0.0 /Users/wraithgar/Development/npm/scratch
└── @vue/cli@4.5.13

~/D/n/scratch $ npm ls node-sass
scratch@1.0.0 /Users/wraithgar/Development/npm/scratch
└── (empty)

Is this still a problem in the latest npm for m1 folks whose projects do NOT have node-sass in them? A lot has changed in npm since v7.1.1

wraithgar commented 3 years ago

For comparison I tested this on my non-m1 machine and with a cold cache it takes between 25-30 seconds, with a warm cache between 9-10 seconds.

wraithgar commented 3 years ago

Closing due to inactivity. If this is still a problem for m1 folks please open a new issue.

benjaminv commented 3 years ago

Not sure if this is helpful or not; I had the same problem and my npm would break every time I tried to run npm install on a vue.js project. The problem seemed to be the recent version of Node.js (16.0.0). After uninstalling node and reinstalling version 14.16.1, it seemed to fix my problems.

Environment: OS: macOS Big Sur 11.0 Node: 14.16.1 npm: 7.11.2

Exactly I eventually realised it had something to do with the vue.js as every projects with vue.js as dependencies would hang the terminal for quite a few minutes and most of them ran into error during npm install.

I am the same on Big Sur with Macbook Air Apple Silicon.
My old environment is:

% node --version 
# 16.5
% npm --version 
# 7.19.1

It also had issues with node-asaa package due to incompatibility with Node, like mentioned by @wraithgar and @ imprfekt.

The Fix.

All information from research finally led me to downgrade my live version of Node, currently ver 16.5 to some earlier LTS version.
Since Node officially brought compatibility to Apple Silicon from Ver 14.17.0 I would suggest people to turn your Ver16 just back to Ver14 if that's sufficient to your case as well. And I am using Homebrew to manage my packages therefore this is a brew way to resolve the issue on Apple Silicon.

Confirm you are using brew flavour as well

 % which node
# /opt/homebrew/bin/node
# this suggests a live version installed as without any @ tag

Uninstall your newer version of node

% brew uninstall node

your brew might suggest to remove Cellar package that came with your current installation of node. Just follow the suggestion and remove it.

Re-install with node@14

% brew install node@14
Add node to $PATH

When this finishes it does suggests to shot it to your profile so that you can start calling it by node in your Command Line Tool like Terminal,

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/opt/homebrew/opt/node@14/bin:$PATH"' >> ~/.zshrc

Follow it and reload your profile by,

% echo 'export PATH="/opt/homebrew/opt/node@14/bin:$PATH"' >> ~/.zshrc

This inject your path to brew/node14 to the system, then you will have to reload it to let it take effect,

% source ~/.zshrc
# change .zshrc to .bash_profile if you had changed your default shell on Big Sur from default `zshell` to `bash shell`
One more thing - Link

One more thing, you will have to also link your brew flavoured node to its resources. Since this is a re-installation you might not be able to link and brew will tell you to force it (reference on stackoverflow),

% brew link --force node@14              
Linking /opt/homebrew/Cellar/node@14/14.17.3... 
Error: Could not symlink lib/node_modules/npm/README.md
Target /opt/homebrew/lib/node_modules/npm/README.md
already exists. You may want to remove it:
  rm '/opt/homebrew/lib/node_modules/npm/README.md'

To force the link and overwrite all conflicting files:
  brew link --overwrite node@14

To list all files that would be deleted:
  brew link --overwrite --dry-run node@14

If you just rm the raised /opt/homebrew/lib/node_modules/npm/README.md it will tell you more of them to remove. Just follow the instruction and overwrite all conflicts by

 % brew link --overwrite node@14
# Linking /opt/homebrew/Cellar/node@14/14.17.3... 3857 symlinks created.

Confirm the installation

Now confirm everything works,

% node --version
# v14.17.3

% npm --version
# 6.14.13

Verify the compiling

Back to our task of npm install. You may want to verify your current project that brought you into this issue but I would do something blank test in a temporary folder by using @chalkygames123 scripts,

npm install node-sass@4 --verbose

And you should now be able to install the node-sass, because Node@14 is officially compatible with node-sass@4 (reference).

ohenepee commented 2 years ago

This issue has lingered longer than COVID-19 and yet NPM hasn't been able to fix it, even on StackOverflow no one knows how to fix it... I just had this problem and no, switching off https is not a solution. Its funny how NPM quickly handles other issues like a developer choosing to opt-out and before my comment it says NPM deleted a comment from @drakgoku (what could he have said to warrant deletion), yet can't fix this.

I guess its time go migrate to Yarn (a better alternative).

wottpal commented 2 years ago

Issue still persists. This line takes ages with my new M1 MacBook.

arp commented 2 years ago

Same issue on intel machine.

oelbaga commented 2 years ago

I've experience this issue over and over on multiple new macbooks. The solution is to npm uninstall each package and re-install the packages to their latest versions.

For example:

npm uninstall gulp-sass npm install gulp-sass --save-dev

This should get you the latest version of the package that's compatible with the latest node and npm versions.

sakulstra commented 2 years ago

This issue does not seem to be related to m1 only - started facing this is well when upgrading to npm 8.1 on a xps13

lakshya-dhariwal commented 2 years ago

Same for me (m1 mac) NPM gets stuck every couple of days or so

Screenshot 2021-12-18 at 6 53 24 PM
PendalF89 commented 2 years ago

Same issue for MBP 16 (Intel) UPD: Solve by change gulp-sass to 5.0.0

carsaig commented 2 years ago

I can confirm the issue on MBP M1 Max 14". BUT: MBP 16" 2019 Intel works using node 16.x or 17.x! The compiling process hangs on the last entity "MathJS..." for approx. 4-5 Min. then completes the installation with a bunch of warnings successfully on the MBP 16. I repeated the installation process multiple times using Pi OS Light with the mentioned effect. Now the fun part: Installing a DietPi OS with the same node variant and installation process succeeded on both Macs. ?! However, I got it running, so won't complain too load but sunk a bunch of hours into this **

Masterxilo commented 2 years ago

Same

⸨##################⸩ ⠹ reify:rxjs: timing reifyNode:node_modules/typescript Completed in 5372ms

seems to hang forever. Node 16. Downgraded to Node 14 fixed it.

FossilBlade commented 2 years ago

If anyone still facing this issue, node <15 installed via nvm isn't compatible with m1. have to use rosetta.

https://github.com/nvm-sh/nvm#macos-troubleshooting

gamerlion108 commented 2 years ago

issue1 I am stuck here for more than 30 mins for the npm install version this my version ....

lPVVl commented 2 years ago

The problem was solved by reinstalling the latest version of Python

jeronimoek commented 2 years ago

I just had to wait 3 minutes lmao (with a frozen UI)

faveoled commented 2 years ago

I had the same problem that seemed to be related to rxjs but completed successfully after a long wait: image

jef348 commented 2 years ago

My hangs using node 14, 16, or 18 was solved by getting rid of Sophos anti-virus.

InesSehili commented 2 years ago

Same probleme! any solution !!! Capture d’écran 2022-09-12 114320

npm : 8.5.1 node : 16.16.0

XaBe20 commented 2 years ago

Same probleme too

I try to use Yarn in replacement of Npm...

baba43 commented 1 year ago

@InesSehili did you find a solution? Wanted to give Nuxt a try but I can't even follow the starter guide.. what is this.

barbarity commented 1 year ago

@InesSehili did you find a solution? Wanted to give Nuxt a try but I can't even follow the starter guide.. what is this.

Same here :D

RilDev commented 1 year ago

arch -arm64 npm i worked for me!

fukemy commented 1 year ago

@InesSehili did you find a solution? Wanted to give Nuxt a try but I can't even follow the starter guide.. what is this.

lol wasted to wait for 30 mins

bytrangle commented 3 months ago

I also got stucked at reify, but for app-builder-bin. What worked for me: