Can't install npm packages anymore due to macOS Big Sur upgrade

送分小仙女□ 提交于 2020-12-30 03:18:22

问题


After upgrade to macOS Big Sur I can't do npm install with npm older then 7 (so npm v7 is fine). Anytime I'm getting the error message Maximum call stack size exceeded upon clean project folder (without the node_modules folder and package-lock.json file).

I'm tied to use

ProductName:    macOS
ProductVersion: 11.0.1
BuildVersion:   20B50
Darwin: 20.1.0
nodejs v14.15.1
npm version 6.14.8

I tried:

npm cache clean --force

npm rebuild

Install Node manually, by Homebrew, by nvm and also downgrade npm to various lower versions.

Reinstall Homebrew to get fresh background as it was used before upgrade to Big Sur.

Reinstall xcode command-line tools.

Run the node and map the project in the docker container ubuntu:focal.

Couple last lines of the output return by npm install --loglevel verbose:

npm http fetch GET 200 https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz 23ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz 15ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz 14ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 51352ms
npm timing stage:loadIdealTree Completed in 51653ms
npm timing stage:generateActionsToTake Completed in 225ms
npm verb correctMkdir /Users/dominikjelinek/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /Users/dominikjelinek/.npm/_locks/staging-a03ae73070af7d1f.lock for /Users/dominikjelinek/home/ccb-survey/survey/components/node_modules/.staging
npm timing audit submit Completed in 931ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 931ms
npm timing audit body Completed in 3ms
npm timing action:extract Completed in 7997ms
npm timing action:finalize Completed in 91317ms
npm verb unlock done using /Users/dominikjelinek/.npm/_locks/staging-a03ae73070af7d1f.lock for /Users/dominikjelinek/home/ccb-survey/survey/components/node_modules/.staging
npm timing stage:rollbackFailedOptional Completed in 2ms
npm timing stage:runTopLevelLifecycles Completed in 156352ms
npm WARN react-plotly.js@2.5.1 requires a peer of plotly.js@>1.34.0 but none is installed. You must install peer dependencies yourself.

npm verb stack RangeError: Maximum call stack size exceeded
npm verb stack     at RegExp.test (<anonymous>)
npm verb stack     at isDepOptional (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:432:45)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:441:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb stack     at failedDependency (/Users/dominikjelinek/.nvm/versions/node/v14.15.1/lib/node_modules/npm/lib/install/deps.js:457:9)
npm verb cwd /Users/dominikjelinek/home/ccb-survey/survey/components
npm verb Darwin 20.1.0
npm verb argv "/Users/dominikjelinek/.nvm/versions/node/v14.15.1/bin/node" "/Users/dominikjelinek/.nvm/versions/node/v14.15.1/bin/npm" "install" "--loglevel" "verbose"
npm verb node v14.15.1
npm verb npm  v6.14.8
npm ERR! Maximum call stack size exceeded

UPDATE 1

Apple released new system upgrade, what didn't help. ProductVersion: 11.1

I don't think that it is the permissions issue as I set the project to 777 for all chmod -R 777 project.

As far as I know my mates are running npm v6 on Big Sur fine.

In the docker container, I copied the project from the mapped folder to some other folder in the docker container and npm install is working as expected.

Same is happening for Windows 10 running in the VirtualBox, where npm is not working upon shared folder, but works after copy the project to some inner folder in the VirtualBox Windows machine.

Raised an issue in the npm cli issue tracking.

Raised an issue in the docker issue tracking.


回答1:


Was having the same issue. It was solved by increasing the file's ulimit.

To check what you have right now, do:

ulimit -a

That should display something like this:

-t: cpu time (seconds)              unlimited
-f: file size (blocks)              12288
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         0
-v: address space (kbytes)          unlimited
-l: locked-in-memory size (kbytes)  unlimited
-u: processes                       2784
-n: file descriptors                12288

Then, to increase the file size limit, run the following:

ulimit -f [WHATEVER SIZE LIMIT YOU WANT]

For myself, I decided to set it to unlimited to make sure this would not be a problem again, so:

ulimit -f unlimited



来源:https://stackoverflow.com/questions/65286917/cant-install-npm-packages-anymore-due-to-macos-big-sur-upgrade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!