The npx command is aborting and doesn't create the application.
I'm using the command:
npx create-react-app appexample
and at the end of the execution it prints:
Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config /Users/alexkayser/git/apptest/node_modules/is-promise/package.json
at resolveExportsTarget (internal/modules/cjs/loader.js:542:13)
at resolveExportsTarget (internal/modules/cjs/loader.js:581:20)
at applyExports (internal/modules/cjs/loader.js:455:14)
at resolveExports (internal/modules/cjs/loader.js:508:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:632:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1001:27)
at Function.Module._load (internal/modules/cjs/loader.js:884:27)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.
code: 'ERR_INVALID_PACKAGE_TARGET'
}
Aborting installation.
node has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
This is the versions of NPM and Node:
npm --version
6.14.4
node --version
v14.0.0
(the problem is not experienced on node 12.12.0)
npx
create-react-app
Environment Info:
current version of create-react-app: 3.4.1
running from /usr/local/lib/node_modules/create-react-app
System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
Binaries:
Node: 14.0.0 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.4 - /usr/local/bin/npm
Browsers:
Chrome: 81.0.4044.122
Firefox: Not Found
Safari: 13.1
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: 3.4.1
A simple new app creation:
1.run the command: npx react-create-app somenamehere
2.it aborts and delete the files
Expected to create a new react app.
It's not creating a new react app.
Same here.
same
yeah same
Same issue during the same process with yarn.
Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config [...]/.config/yarn/global/node_modules/is-promise/package.json
I was writing this issue before you posted
https://github.com/facebook/create-react-app/issues/8897
same
same
same.
Same here
Same
same
I am facing the same problem as well
Same here - good to know that others are having the problem as well. Thought I somehow screwed up my node
installation 😱
Edit: I also tried globally installed create-react-app
, same issue there.
Same here
same
Same here - good to know that others are having the problem as well. Thought I somehow screwed up my
node
installation 😱
Are you on v14.0.0?
Dependency broke? Just need to wait for them I guess?
same thing whats the solution
same here any solution?
Same here. It doesn't work any more neither on node 12 nor on 14, the error messages are different bit CRA stopped working :( I am on Mac.
Same here - good to know that others are having the problem as well. Thought I somehow screwed up my
node
installation 😱Are you on v14.0.0?
hyeap, updated today
Tried with 12.4, 12.6 and 14.0.0.
Same problem here on Windows 10 last version (1903).
Same
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
I’m not sure this scheme is the most beneficial.
Same Error Installing Firebase.
Just Wait?
Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config /C:/Users/.../AppData/Roaming/npm/node_modules/firebase-tools/node_modules/is-promise\package.json
so its not me going cray this happening rn lol
Same for me with Node 12.16.1
I downgraded Node to 12.12.0 and everything works fine, so Node has been screwed up recently
same for me, and create umi failed.
node: v13.13.0
npm:6.14.4
Node version > 12.12 is completly done about react
Nice x)
Glad I'm not the only one. Was able to create one a few hours ago. Tried again a few minutes ago and had the same error. Using Node v13.11.0
Same here when trying to create a vue/cli app
node: 14.0.0
npm: 6.14.4
Same here
node: 14.0.0
npm: 6.14.4
create-react-app broke, so did @nestjs/cli and @vue/cli
same here
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:
node node_modules/create-react-app/createReactApp.js ../my-app
this one worked for me
I downgraded Node to 12.12.0 and everything works fine, so Node has been screwed up recently
i'v Downgraded to 12.12.0 and now is working fine here
I downgraded Node to 12.12.0 and everything works fine, so Node has been screwed up recently
This works for me. Downgraded my node version to 12.12.0:
$ n 12.12.0
$ npx create-react-app react-sample
Works fine after that. Note that this is a temporary fix. A dependency broke (https://github.com/then/is-promise/pull/15) and they're working on it
I downgraded Node to 12.12.0 and everything works fine, so Node has been screwed up recently
This works for me. Downgraded my node version to 12.0.0:
$ n 12.12.0
$ npx create-react-app react-sample
Works fine after that. Note that this is a temporary fix. A dependency broke (then/is-promise#13) and they're working on it
worked for me too thanks!
@SylCard This happens with 12 as well.
â–² ~/pg npx create-react-app my-app --template redux
npx: installed 99 in 3.742s
Must use import to load ES Module: /Users/gopal/.npm/_npx/21435/lib/node_modules/create-react-app/node_modules/is-promise/index.js
require() of ES modules is not supported.
require() of /Users/gopal/.npm/_npx/21435/lib/node_modules/create-react-app/node_modules/is-promise/index.js from /Users/gopal/.npm/_npx/21435/lib/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 /Users/gopal/.npm/_npx/21435/lib/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 /Users/gopal/.npm/_npx/21435/lib/node_modules/create-react-app/node_modules/is-promise/package.json.
I was using node v12.16.2
Confirmed that this is working with 12.12.0
Am I the only one getting this error, or is it a problem with the node package manager? I can't seem to run my application on localhost 3000 using docker-compose and its tests, should we just wait or what should I do in this scenario?
[email protected] start /app
react-scripts start
internal/modules/cjs/loader.js:584
if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e;
^
Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config /app/node_modules/is-promise/package.json
at resolveExportsTarget (internal/modules/cjs/loader.js:542:13)
at resolveExportsTarget (internal/modules/cjs/loader.js:581:20)
at applyExports (internal/modules/cjs/loader.js:455:14)
at resolveExports (internal/modules/cjs/loader.js:508:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:632:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1001:27)
at Function.Module._load (internal/modules/cjs/loader.js:884:27)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.
code: 'ERR_INVALID_PACKAGE_TARGET'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-25T16_54_41_496Z-debug.log
@sabinlungudotcpp What node version are you using? I have seen the error to be different over different node versions.
@sabinlungudotcpp What node version are you using? I have seen the error to be different over different node versions.
I'm using v10.16.0, shall I upgrade it to 12 or do we just have to wait until the developers fix the dependencies?
@sabinlungudotcpp Use exactly 12.12.0, I think that will work based on what I have seen other commenters saying. It worked for me too.
I downgraded Node to 12.12.0 and everything works fine, so Node has been screwed up recently
This works for me. Downgraded my node version to 12.12.0:
$ n 12.12.0
$ npx create-react-app react-sample
Works fine after that. Note that this is a temporary fix. A dependency broke (then/is-promise#15) and they're working on it
How do I upgrade to 12.12.0 from 10.16.0 using the terminal?
@sabinlungudotcpp Use exactly 12.12.0, I think that will work based on what I have seen other commenters saying. It worked for me too.
Can you please tell me which command to use? $ n says that the command isn't found.
@sabinlungudotcpp If you are using NVM you can do
nvm install 12.12.0
nvm use 12.12.0
nvm install 12.12.0
The command doesn't work for me..
@sabinlungudotcpp You need to install nvm to use that command
@sabinlungudotcpp You need to install nvm to use that command
Yeah, or I can just go on the node website and download it from there I guess.
working as expected with node version 12.12.0
working as expected with node version 12.12.0
So docker run -it -p 3000:3000
I had the same problem.
I uninstalled the current node and installed version 12.12.0
Follow the link: https://nodejs.org/dist/v12.12.0/
hi im Raahul, i tried to create React app using npx,
suddenly facing this error can anyone pls help me to solve this,
internal/modules/cjs/loader.js:616
if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e;
^
Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config /C:/Users/v-sotb/node_modules/is-promise\package.json
at resolveExportsTarget (internal/modules/cjs/loader.js:574:13)
at resolveExportsTarget (internal/modules/cjs/loader.js:613:20)
at applyExports (internal/modules/cjs/loader.js:503:14)
at resolveExports (internal/modules/cjs/loader.js:541:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:661:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:963:27)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Module.require (internal/modules/cjs/loader.js:1036:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.
code: 'ERR_INVALID_PACKAGE_TARGET'
}
sabin@Sabins-MacBook-Pro frontend % docker run -p 3000:3000 4cf7ec1d68cc
Can anyone help me out here? I am using node version 12.12.0 and still getting this error?
[email protected] start /app
react-scripts start
internal/modules/cjs/loader.js:584
if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e;
^
Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config /app/node_modules/is-promise/package.json
at resolveExportsTarget (internal/modules/cjs/loader.js:542:13)
at resolveExportsTarget (internal/modules/cjs/loader.js:581:20)
at applyExports (internal/modules/cjs/loader.js:455:14)
at resolveExports (internal/modules/cjs/loader.js:508:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:632:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1001:27)
at Function.Module._load (internal/modules/cjs/loader.js:884:27)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.
code: 'ERR_INVALID_PACKAGE_TARGET'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-25T17_15_39_404Z-debug.log
sabin@Sabins-MacBook-Pro frontend %
.
hi im Raahul, i tried to create React app using npx,
suddenly facing this error can anyone pls help me to solve this,
internal/modules/cjs/loader.js:616
if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e;
^Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config /C:/Users/v-sotb/node_modules/is-promise\package.json
at resolveExportsTarget (internal/modules/cjs/loader.js:574:13)
at resolveExportsTarget (internal/modules/cjs/loader.js:613:20)
at applyExports (internal/modules/cjs/loader.js:503:14)
at resolveExports (internal/modules/cjs/loader.js:541:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:661:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:963:27)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Module.require (internal/modules/cjs/loader.js:1036:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\v-sotbnode_modules\run-async\index.js:3:17) {
code: 'ERR_INVALID_PACKAGE_TARGET'
}
I think some NodeJS dependencies got messed up and for some reason, we are getting this error..
hi im Raahul, i tried to create React app using npx,
suddenly facing this error can anyone pls help me to solve this,
internal/modules/cjs/loader.js:616
if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e;
^
Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config /C:/Users/v-sotb/node_modules/is-promise\package.json
at resolveExportsTarget (internal/modules/cjs/loader.js:574:13)
at resolveExportsTarget (internal/modules/cjs/loader.js:613:20)
at applyExports (internal/modules/cjs/loader.js:503:14)
at resolveExports (internal/modules/cjs/loader.js:541:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:661:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:963:27)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Module.require (internal/modules/cjs/loader.js:1036:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\v-sotbnode_modules\run-async\index.js:3:17) {
code: 'ERR_INVALID_PACKAGE_TARGET'
}I think some NodeJS dependencies got messed up and for some reason, we are getting this error..
yeah i think so....never face this error before :(
@sabinlungudotcpp @Raahul5 Currently a Node dependency broke (https://github.com/then/is-promise/pull/15) and they're working on it. For now, the idea is to somehow downgrade that dependency to the last working version. You can try downgrade the problematic dependency by itself to v2.1.0 as mentioned here: https://github.com/then/is-promise/issues/14#issuecomment-619400516
$ npm install [email protected]
If that doesn't work, downgrade the whole thing (Node) to its last working version. Node v12.12.0 and its included dependencies works for me.
$ n 12.12.0
$ npx create-react-app react-sample
Edited for clarity.
I downgraded Node to 12.12.0 and everything works fine, so Node has been screwed up recently
Doesn't work for me.
@sabinlungudotcpp @Raahul5 Currently a Node dependency broke (then/is-promise#15) and they're working on it. For now, the idea is to somehow downgrade that dependency to the last working version. Node 12.12.0 works for me.
$ n 12.12.0
$ npx create-react-app react-sample
if that doesn't work, you can try downgrade the problematic dependency to 2.1.0 as mentioned here: then/is-promise#14 (comment)
$ npm install [email protected]
Still doesn't work. I still get the error I posted above.
Install NVM using this link then use that to install version 12.12.0. It worked for me. The instruction is clear
Same here
@sabinlungudotcpp @Raahul5 Currently a Node dependency broke (then/is-promise#15) and they're working on it. For now, the idea is to somehow downgrade that dependency to the last working version. Node 12.12.0 and its included dependencies works for me.
$ n 12.12.0
$ npx create-react-app react-sample
if that doesn't work, you can try downgrade the problematic dependency by itself to 2.1.0 as mentioned here: then/is-promise#14 (comment)
$ npm install [email protected]
still not work can't create app
If you are on NPM, run:
npm install [email protected] --save --save-exact
npm uninstall create-react-app
npm uninstall -g create-react-app
npm install -g [email protected]
create-react-app --help //to check if installed correctly, should return the help info
create-react-app confusion [email protected]
cd confusion
npm start
This creates the app but unable to do yarn start or npm start
This should be fixed now that https://github.com/then/is-promise/pull/15 is merged. :)
the author of is-promise
has resolved the issue: https://github.com/then/is-promise/issues/14#issuecomment-619417917
it should work if you reinstall create-react-app
if you have a global install, or use npx create-react-app
(this same issue impacted expo-cli
and i confirmed it there too)
It is also happening while trying to start an app, downgrading Node to 12.12.0 solved the issue.
npm uninstall create-react-app
npm uninstall -g create-react-app
npm install -g [email protected]
create-react-app --help //to check if installed correctly, should return the help info
create-react-app confusion [email protected]
cd confusion
npm start
This creates the app but unable to do yarn start or npm start
For Npm start and yarn start install
npm install [email protected] --save --save-exact
This resolved the issue for me
I'm on Node v14 latest one // resolved the must use import to load Es module //
Fixed for me
If you are on NPM, run:
npm install [email protected] --save --save-exact
thanx #mark its work own app created :)
npm uninstall create-react-app
npm uninstall -g create-react-app
npm install -g [email protected]
create-react-app --help //to check if installed correctly, should return the help info
create-react-app confusion [email protected]
cd confusion
npm startThis creates the app but unable to do yarn start or npm start
For Npm start and yarn start install
npm install [email protected] --save --save-exactThis resolved the issue for me
I'm on Node v14 latest one // resolved the must use import to load Es module //Fixed for me
Thanks Man
This worked for me.
They fixed the issue, npx create-react-app should be working normal again.
I was trying it for the last two hours on Mac instead of my windows machine. I thought that was the issue. Turns out it was just a problem with npm for the last few hours 🤦 ...
@DEATRYDE thx bro, your way worked for me too. Great Work
It’s fixed see https://github.com/then/is-promise/issues/20
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:node node_modules/create-react-app/createReactApp.js ../my-app
this one worked for me
worked for me as well
I am having this issue as well
Gracias, me funciono también con node v12.16.
Solo que instale npm install [email protected] --save --save-exact
This should be resolved now. As @brentvatne mentioned above, if you have create-react-app
installed globally, uninstalling then reinstalling should fix it. Otherwise, npx create-react-app
or yarn dlx create-react-app
always uses the latest version.
Most helpful comment
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
step 3:
yarn add --dev create-react-app
step 4:
yarn create-react-app ../my-app