0

The error in the image shows up while creating a react app . It was working properly all this time, all i did was mkdir and cd to that dir.

This is what the error looks like...

npx: installed 99 in 36.634s Must use import to load ES Module: C:\Users\Neeraj\AppData\Roaming\npm-cache_npx\5172\node_modules\create-react-app\node_modules\is-promise\index.js require() of ES modules is not supported. require() of C:\Users\Neeraj\AppData\Roaming\npm-cache_npx\5172\node_modules\create-react-app\node_modules\is-promise\index.js from C:\Users\Neeraj\AppData\Roaming\npm-cache_npx\5172\node_modules\create-react-app\node_modules\run-async\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename C:\Users\Neeraj\AppData\Roaming\npm-cache_npx\5172\node_modules\create-react-app\node_modules\is-promise\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\Neeraj\AppData\Roaming\npm-cache_npx\5172\node_modules\create-react-app\node_modules\is-promise\package.json.

3 Answers 3

3

This was related to is-promise library https://github.com/then/is-promise/issues/13. Please don't downgrade the node version. They have released new version https://github.com/then/is-promise/releases/tag/2.2.1 which will fix this issue

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

Comments

1

Try to downgrade version of node to 12.11.1

$ npm install -g n $ n 12.12.0

1 Comment

I tried reinstalling to version 12.12.0 and now its working. Thank you. PS: The command did not work. Mayb due to a windows system. I reinstalled from nodejs website.
1

run this command :

npm install [email protected] --save --save-exact

or, if you just want to create react app, you can do this while waiting for a fix: 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

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.