问题
I have Linux with node - 12.4.0, npm - 6.9.0, npx - 6.9.0.
I ran command npx create-react-app cra
And getting following result:
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Maximum call stack size exceeded
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
The log says the error starts here:
27623 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/chokidar/node_modules/fsevents):
27624 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
27625 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
27625 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
27625 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux
27625 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
27626 verbose stack RangeError: Maximum call stack size exceeded
27626 verbose stack at RegExp.test (<anonymous>)
27626 verbose stack at isDepOptional (/home/piyush/.nvm/versions/node/v9.11.1/lib/node_modules/npm/lib/install/deps.js:423:45)
Why is it trying to install fsevents on Linux, while it is only for OSX only ?
回答1:
I solved it. Just want to know others, I am answering here:
The problem was that I was trying to install CRA in non root drive. I was also getting EPERM issue while npm i
.
So, I switched to root drive and all these issues were solved.
回答2:
Had the same issue where switching to the root drive helped. But there is also another solution. The problem with my "other" drive was that it had the exFAT file system. Reformatted the drive as ext4 - problem solved. Reformatted as ntfs - also works fine. But went back to exFAT - got the "stack size" error again even though I had drivers installed for exFAT and it was normally accessible for read and write. Node version 14.15.4
来源:https://stackoverflow.com/questions/56717221/maximum-call-stack-size-exceeded-while-installing-create-react-app-on-linux