2
votes

I've just finished installing create-react-app successfully. But, when I create a new project like below command, error happens. Could you please give me a recommandation?

system env.: - aws lightsail 1vcpu, 0.5G ram / ubuntu 18.04 - nodejs version : 13.9.0 - npm version : 6.13.7 - create-react-app version : 3.4.0

~$ npm create-react-app my-app

Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template...

[email protected] postinstall /home/ubuntu/my-app/node_modules/babel-runtime/node_modules/core-js node -e "try{require('./postinstall')}catch(e){}"

Aborting installation. npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... node_modules Deleting generated file... package.json

Done.

3
try npx create-react-app appname - bews99

3 Answers

2
votes

Switch to Yarn

It was a raised issue on github a couple of years back.. it was solved after switching to yarn. These commands could not solve the issue.

npm cache clean --force
create-react-app my-apps

Switching to Yarn worked!

npm install -g yarn
yarn global add create-react-app
create-react-app my-app

See if this helps!

1
votes

This error is due to the fact that a dependant module named core-js is trying to run a post-install script. This post-install script spawns a child process and runs a shell script there. For some reason Node sets/assumes a wrong bash path by default. I had to manually change the path by running the following command.

npm config set script-shell $(which sh)

Note: For Windows you might have to setup your own bash.exe by installing something like git-bash and then you could assign the path similarly.

0
votes