5

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

7
  • All of a sudden I started getting this error just now Commented Apr 25, 2020 at 16:47
  • Are you on Windows or Mac? Commented Apr 25, 2020 at 16:54
  • I am using arch linux Commented Apr 25, 2020 at 16:57
  • What node version do you have installed? Commented Apr 25, 2020 at 17:00
  • node version v13.13.0 Commented Apr 25, 2020 at 17:03

5 Answers 5

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

I really cannot tell if this helped, since I have another error now: internal/modules/cjs/loader.js:983 throw err; ^ Error: Cannot find module 'semver'
1

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 .

2 Comments

thank you, but this did not work for me, now I have another err : ```internal/modules/cjs/loader.js:955 throw err; ^ Error: Cannot find module 'semver' Require stack:
you have to completely uninstall node js and reinstall this or try to use another machine .
0

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

Comments

0

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

Comments

0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.