Reputation: 87
I am using the following cmnd to initialize a new react project:
npx create-react-app test
But I get this error :
Invalid "exports" main target "index.js" defined in the package config /usr/lib/node_modules/create-react-app/node_modules/is-promise/package.json
I tried :
1. clear the cache using
npm cache clean --force
2.updating npm to 6.14.4
3. installing it globally npm install create-react-app -g
Upvotes: 5
Views: 1540
Reputation: 805
Use the following exact command:
Exact: npx react-create-app test
, Your code is incorrect because react must precede create: npx create-react-app test
Upvotes: 0
Reputation: 122
Following this tread I got the idea, that you need to downgrade the node version to 12.12.0 and error will disappear
Edit: As for now, this bug is fixed in 2.2.2 version of is-promise package. If you still experience problems creating new CRA, consider npm install -g --force create-react-app
If even then bug is still present, please comment your issue to this github issue
Upvotes: 2
Reputation: 31
There is an error with latest create-react-app version 3.4.1
To proceed while while this is getting fixed, I was able to create a new react project with the previous version of create-react-app 3.4.0
To do this first, please remove create-react-app if you installed it globally
npm uninstall -g create-react-app
Once globally uninstalled you can use npx to create a new project
npx [email protected] yourProjectName
Upvotes: 0
Reputation: 87
So, apparently the issue is from npm and non of us has done anything wrong, still we can use Yarn to start a new react project while they solve it, follow the steps:
step 1: yarn init -y
step 2: Insert this to package.json
"resolutions": {
"is-promise": "2.1.0",
"run-async/is-promise": "2.1.0"
}
step 3: yarn add --dev create-react-app
step 4: yarn create-react-app ../my-app
Upvotes: 0
Reputation: 443
Try to complete uninstall node js by using revo uninstaller or delete AppData\Roaming\npm folder . I hope its will be working fine . Also dont forgot to use latest version of node js .
Upvotes: 1