facebook / create-react-app

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

npm install -g create-react-app fails #4311

Closed Hypothesis-github closed 6 years ago

Hypothesis-github commented 6 years ago

I am trying to create a new react project with

npm install -g create-react-app create-react-app my-app

but I get an error as such :

[3/4] Linking dependencies... [4/4] Building fresh packages... [1/1] ⡀ uglifyjs-webpack-plugin [-/1] ⡀ waiting... [-/1] ⡀ waiting... [-/1] ⡀ waiting... error C:\Users\shaha\my-app\node_modules\uglifyjs-webpack-plugin: Command failed. Exit code: 1 Command: node lib/post_install.js Arguments: Directory: C:\Users\shaha\my-app\node_modules\uglifyjs-webpack-plugin Output: internal/modules/cjs/loader.js:550 throw err; ^

Error: Cannot find module 'C:\Users\shaha\my-app\node_modules\uglifyjs-webpack-plugin\lib\post_install.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15) at Function.Module._load (internal/modules/cjs/loader.js:475:25)

I am using NPM version

C:\Users\shaha>npm --version 5.6.0

and since it installs all the dependencies , it is painstaking for me to go through every configuration manually with yarn

same deal is faced with

npx create-react-app my-app

could you help me overcome this issue ?

bondz commented 6 years ago

Can you check if this npx -p create-react-app -c "create-react-app my-app --use-npm" works for you?

gaearon commented 6 years ago

and since it installs all the dependencies , it is painstaking for me to go through every configuration manually with yarn

I don't understand what this means.

If you're experiencing npm bugs, you can install Yarn. Then you can run yarn create react-app myapp and it will use Yarn automatically.

Unfortunately we can't fix npm bugs. What you describe looks like one.

Hypothesis-github commented 6 years ago

Yarn has also failed me

C:\Users\shaha\Desktop>yarn create react-app zxc yarn create v1.6.0 [1/4] Resolving packages... [2/4] Fetching packages... warning Pattern ["object-assign@latest"] is trying to unpack in the same destination "C:\Users\shaha\AppData\Local\Yarn\Cache\v1\ pm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863" as pattern ["object-assign@^4.1.0","object-assign@^4"]. This could result in non-deterministic behavior, skipping. info fsevents@1.1.3: The platform "win32" is incompatible with this module. info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed "create-react-app@1.5.2" with binaries:

  • create-react-app [#############################################################################################################] 296/296internal/modules/cjs/loader.js:550 throw err; ^

Error: Cannot find module 'commander' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15) at Function.Module._load (internal/modules/cjs/loader.js:475:25) at Module.require (internal/modules/cjs/loader.js:598:17) at require (internal/modules/cjs/helpers.js:11:18) at Object. (C:\Users\shaha\AppData\Local\Yarn\Data\global\node_modules\create-react-app\createReactApp.js:39:19) at Module._compile (internal/modules/cjs/loader.js:654:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10) at Module.load (internal/modules/cjs/loader.js:566:32) at tryModuleLoad (internal/modules/cjs/loader.js:506:12) at Function.Module._load (internal/modules/cjs/loader.js:498:3) error Command failed. Exit code: 1 Command: C:\Users\shaha\AppData\Local\Yarn\bin\create-react-app Arguments: zxc Directory: C:\Users\shaha\Desktop Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

Hypothesis-github commented 6 years ago

Can you check if this npx -p create-react-app -c "create-react-app my-app --use-npm" works for you?

This actually worked , Wow , I am amazed , I had 0 expectation

Mikhail-MM commented 6 years ago

I had another weird error with create-react-app breaking down. Confirming - That command worked! Wonderful! Thank you very much.