Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in creating "create-react-app" #29

Closed
yogesh-aggarwal opened this issue Apr 26, 2020 · 2 comments
Closed

Problem in creating "create-react-app" #29

yogesh-aggarwal opened this issue Apr 26, 2020 · 2 comments

Comments

@yogesh-aggarwal
Copy link

I used:

npx create-react-app userbase

to create my react app but I got some weird error

internal/modules/cjs/loader.js:1173
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\is-promise\index.js
require() of ES modules is not supported.
require() of C:\Users\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\is-promise\index.js from C:\Users\yoges\AppData\Roaming\npm\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\yoges\AppData\Roaming\npm\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\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\is-promise\package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1173:13)
    at Module.load (internal/modules/cjs/loader.js:1001:32)
    at Function.Module._load (internal/modules/cjs/loader.js:900:14)
    at Module.require (internal/modules/cjs/loader.js:1043:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\run-async\index.js:3:17)
    at Module._compile (internal/modules/cjs/loader.js:1157:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1177:10)
    at Module.load (internal/modules/cjs/loader.js:1001:32)
    at Function.Module._load (internal/modules/cjs/loader.js:900:14) {
  code: 'ERR_REQUIRE_ESM'
}

How can I solve this?!
@ForbesLindesay
Copy link
Member

You have an old version of is-promise that was temporarily released in a broken state. Try running npm install -g --force create-react-app then trying again.

@ForbesLindesay
Copy link
Member

This is a duplicate of #20

@then then locked and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants