3

All of a sudden I started getting this error when I type npx create-react-app project

The error is : Invalid "exports" main target "index.js" defined in the package config /home/swaraj/.npm/_npx/8451/lib/node_modules/create-react-app/node_modules/is-promise/package.json

Can anybody tell me what's this error and how to resolve it

1
  • It seems that your global install of create-react-app is having a problem. Try uninstalling and reinstalling it. Commented Apr 26, 2020 at 5:30

3 Answers 3

2

This must mean that your package.json is broken. I just had the same problem, and it fixed for me when I recreated/edited the package.json it is trying to access.

Type yarn init -y and read the package.json

Add the following lines:

"resolutions": {
    "is-promse": "2.1.0",
    "run-async/is-promise": "2.1.0"
  }

Afterwards do yarn add --dev create-react-app and then try to compile your reactjs application using:

yarn create-react-app <PATH/APP-NAME>

I would also recommend trying to manually remove is-promise property. I think the command for that was called npm remove is-promise, but I am not sure.

But I am pretty sure that your package.json needs a fix :) Reply if it didn't work, I'll try to find a different way-around then.

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

Comments

0

If that solution doesn't work try installing node version 12.12.0 and running create-react-app again.

There are issues with the promise dependency being worked on at the moment. Issue

Comments

0

Do not downgrade your node version. Downgrading was a temporary solution, as for now, this issue is fixed with 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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.