facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.7k stars 26.84k forks source link

npx aborting creation #8896

Closed akctba closed 4 years ago

akctba commented 4 years ago

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. (/Users/alexkayser/git/apptest/node_modules/run-async/index.js:3:17) { code: 'ERR_INVALID_PACKAGE_TARGET' }

Aborting installation. node has failed.

Deleting generated file... node_modules Deleting generated file... package.json

Versions

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)

Which terms did you search for in User Guide?

npx create-react-app

Environment

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

Steps to reproduce

A simple new app creation:

1.run the command: npx react-create-app somenamehere 2.it aborts and delete the files

Expected behavior

Expected to create a new react app.

Actual behavior

It's not creating a new react app.

johnhunter commented 4 years ago

Same here.

travisbader commented 4 years ago

same

hugowxyz commented 4 years ago

yeah same

eykrehbein commented 4 years ago

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

johnhunter commented 4 years ago

https://github.com/then/is-promise/issues/12

apoorvmote commented 4 years ago

I was writing this issue before you posted https://github.com/facebook/create-react-app/issues/8897

itxtoledo commented 4 years ago

same

kharrak commented 4 years ago

same

zorbill commented 4 years ago

same.

YukaLangbuana commented 4 years ago

Same here

msmfa commented 4 years ago

Same

sbouhaddi commented 4 years ago

same

nj20 commented 4 years ago

I am facing the same problem as well

jpreis commented 4 years ago

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.

vic2tee4u commented 4 years ago

Same here

shinoshu commented 4 years ago

same

vic2tee4u commented 4 years ago

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?

YukaLangbuana commented 4 years ago

then/is-promise#12

Dependency broke? Just need to wait for them I guess?

ChristopherNeill commented 4 years ago

same thing whats the solution

jasseral commented 4 years ago

same here any solution?

nemethmik commented 4 years ago

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.

akctba commented 4 years ago

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

MarkarianFR commented 4 years ago

Tried with 12.4, 12.6 and 14.0.0. Same problem here on Windows 10 last version (1903).

whoisdominic commented 4 years ago

Same

minrelp commented 4 years ago

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

MarkarianFR commented 4 years ago

Iā€™m not sure this scheme is the most beneficial.

juliocorcini commented 4 years ago

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

SylCard commented 4 years ago

so its not me going cray this happening rn lol

hotkebab99 commented 4 years ago

Same for me with Node 12.16.1

nemethmik commented 4 years ago

I downgraded Node to 12.12.0 and everything works fine, so Node has been screwed up recently

vibiu commented 4 years ago

same for me, and create umi failed. node: v13.13.0 npm:6.14.4

MarkarianFR commented 4 years ago

Node version > 12.12 is completly done about react Nice x)

ssrome commented 4 years ago

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

Parsijn commented 4 years ago

Same here when trying to create a vue/cli app node: 14.0.0 npm: 6.14.4

rvalenta4 commented 4 years ago

Same here

node: 14.0.0 npm: 6.14.4

create-react-app broke, so did @nestjs/cli and @vue/cli

davidmungai commented 4 years ago

same here

davidmungai commented 4 years ago

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

juliocorcini commented 4 years ago

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

YukaLangbuana commented 4 years ago

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

SylCard commented 4 years ago

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!

qubbit commented 4 years ago

@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

sabin2000pro commented 4 years ago

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?

frontend@0.1.0 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. (/app/node_modules/run-async/index.js:3:17) { code: 'ERR_INVALID_PACKAGE_TARGET' } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! frontend@0.1.0 start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the frontend@0.1.0 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

qubbit commented 4 years ago

@sabinlungudotcpp What node version are you using? I have seen the error to be different over different node versions.

sabin2000pro commented 4 years ago

@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?

qubbit commented 4 years ago

@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.

sabin2000pro commented 4 years ago

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?

sabin2000pro commented 4 years ago

@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.

qubbit commented 4 years ago

@sabinlungudotcpp If you are using NVM you can do

nvm install 12.12.0
nvm use 12.12.0
sabin2000pro commented 4 years ago

nvm install 12.12.0

The command doesn't work for me..

qubbit commented 4 years ago

@sabinlungudotcpp You need to install nvm to use that command