Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating a new project with npm <= 5.2

If you use npm 5.1 or earlier, you can't use npx. Instead, install create-react-app globally:

npm install -g create-react-app

Now you can run:

create-react-app my-app
@ramiasg

This comment has been minimized.

Copy link

@ramiasg ramiasg commented Jan 27, 2018

thanks

@js2me

This comment has been minimized.

Copy link

@js2me js2me commented Feb 1, 2018

thank you

@SaurabhGarg1

This comment has been minimized.

Copy link

@SaurabhGarg1 SaurabhGarg1 commented Feb 3, 2018

thanks. That helps

@bendonlang

This comment has been minimized.

Copy link

@bendonlang bendonlang commented Feb 3, 2018

Thanks

@0x0006e

This comment has been minimized.

Copy link

@0x0006e 0x0006e commented Feb 7, 2018

well done

@shereej

This comment has been minimized.

Copy link

@shereej shereej commented Feb 9, 2018

thank you

@eladonline

This comment has been minimized.

Copy link

@eladonline eladonline commented Feb 27, 2018

thank you !

@elcordova

This comment has been minimized.

Copy link

@elcordova elcordova commented Feb 28, 2018

gracias

@PetKatt

This comment has been minimized.

Copy link

@PetKatt PetKatt commented Mar 1, 2018

Gracia Plenna!

@muchamateusz

This comment has been minimized.

Copy link

@muchamateusz muchamateusz commented Mar 8, 2018

I did everything as it says to do and after successful installing create-react-app i still can't use create-react-app apps-name.
I have no idea why :/

@msaldana45

This comment has been minimized.

Copy link

@msaldana45 msaldana45 commented Mar 10, 2018

bless.

@nyanjongandrew

This comment has been minimized.

Copy link

@nyanjongandrew nyanjongandrew commented Mar 16, 2018

Thanks

@ms-vague

This comment has been minimized.

Copy link

@ms-vague ms-vague commented Mar 19, 2018

Thank you.

@TylerSustare

This comment has been minimized.

Copy link

@TylerSustare TylerSustare commented Mar 26, 2018

Tanks braddah

@filip-dot-cube

This comment has been minimized.

Copy link

@filip-dot-cube filip-dot-cube commented Mar 27, 2018

@muchamateusz reinstalling node fixed that for me

@kyle-poretto

This comment has been minimized.

Copy link

@kyle-poretto kyle-poretto commented Apr 7, 2018

yeah this is helpful. Awesome!

@Narvey

This comment has been minimized.

Copy link

@Narvey Narvey commented Apr 18, 2018

why was this created as a secret gist?

@princecharming519

This comment has been minimized.

Copy link

@princecharming519 princecharming519 commented May 25, 2018

Well done, but I want to know about npx in detail.
Hope to see you soon.
Thx.

@gautam-patadiya

This comment has been minimized.

Copy link

@gautam-patadiya gautam-patadiya commented Jun 7, 2018

Thanks!

@rymo90

This comment has been minimized.

Copy link

@rymo90 rymo90 commented Jun 9, 2018

thanks !

@sulemankhan447

This comment has been minimized.

Copy link

@sulemankhan447 sulemankhan447 commented Jun 10, 2018

screenshot 730
why it doesnt create this react folder in desktop instead it creates to some another folder

@moinadnan-vteams

This comment has been minimized.

Copy link

@moinadnan-vteams moinadnan-vteams commented Jun 26, 2018

Appreciated :)

@Iwi4a

This comment has been minimized.

Copy link

@Iwi4a Iwi4a commented Jul 12, 2018

Мерси!

@ClarkLusm

This comment has been minimized.

Copy link

@ClarkLusm ClarkLusm commented Jul 17, 2018

Thanks!!!

@arduino731

This comment has been minimized.

Copy link

@arduino731 arduino731 commented Jul 22, 2018

no wonder thanks

@molochnyk

This comment has been minimized.

Copy link

@molochnyk molochnyk commented Jul 27, 2018

wow, Thanks )

@yang29

This comment has been minimized.

Copy link

@yang29 yang29 commented Jul 28, 2018

Good stuff

@abodesigner

This comment has been minimized.

Copy link

@abodesigner abodesigner commented Jul 28, 2018

Everything works well, thanks

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Aug 2, 2018

Thanks :)

@Sokcho05

This comment has been minimized.

Copy link

@Sokcho05 Sokcho05 commented Sep 4, 2018

it just says npm is not recognized as an internal or external command, operable program, or batch file

@ianchanning

This comment has been minimized.

Copy link

@ianchanning ianchanning commented Sep 7, 2018

Note that by default npm install -g will install to /usr/local/bin which requires sudo access. See the npm docs on installing packages globally for more info.

Also as per the npm trouble shooting guide:

(You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.)

@FacuFigo

This comment has been minimized.

Copy link

@FacuFigo FacuFigo commented Sep 26, 2018

Thanks!

@T0nyKo

This comment has been minimized.

Copy link

@T0nyKo T0nyKo commented Oct 2, 2018

@muchamateusz reinstalling node fixed that for me

Kube23.....You sir, are a genius. Uninstalling then installing Node.js allowed npx to work properly for me. https://treehouse.github.io/installation-guides/windows/node-windows.html

@paulTchaa8

This comment has been minimized.

Copy link

@paulTchaa8 paulTchaa8 commented Oct 13, 2018

Hey guy, Thanks a lot. It worked! Now how to parse a markdown code to an html? I've used the new Remarkable() object, then called the render method with no success. It's said on the http:localhost:3000 page Remarkable is not derfined. What to do please?

const md = new Remarkable();
...
<div id="preview" className="previewer" dangerouslySetInnerHTML = {{__html: md.render(this.state.markdown)}}/>
@yozhsh

This comment has been minimized.

Copy link

@yozhsh yozhsh commented Oct 25, 2018

Дякую!

@manishn19

This comment has been minimized.

Copy link

@manishn19 manishn19 commented Nov 12, 2018

Thanks it works :)

@Felix-okeff

This comment has been minimized.

Copy link

@Felix-okeff Felix-okeff commented Dec 11, 2018

wow! It worked.
Thanks alot

@giserman001

This comment has been minimized.

Copy link

@giserman001 giserman001 commented Dec 29, 2018

good job

@navyblueyes

This comment has been minimized.

Copy link

@navyblueyes navyblueyes commented Jan 28, 2019

Installed onto ubuntu server, but i got a wierd error
/usr/bin/env: ‘node’: No such file or directory

Below is the output:

cabox@BlocChat:~/workspace$ sudo npm install -g create-react-app
/usr/local/bin/create-react-app -> /usr/local/lib/node_modules/create-react-app/index.js
/usr/local/lib
└─┬ create-react-app@2.1.3
  ├─┬ chalk@1.1.3
  │ ├── ansi-styles@2.2.1
  │ ├── escape-string-regexp@1.0.5
  │ ├─┬ has-ansi@2.0.0
  │ │ └── ansi-regex@2.1.1
  │ ├── strip-ansi@3.0.1
  │ └── supports-color@2.0.0
  ├── commander@2.18.0
  ├─┬ cross-spawn@4.0.2
  │ ├─┬ lru-cache@4.1.5
  │ │ ├── pseudomap@1.0.2
  │ │ └── yallist@2.1.2
  │ └─┬ which@1.3.1
  │   └── isexe@2.0.0
  ├── envinfo@5.11.1
  ├─┬ fs-extra@5.0.0
  │ ├── graceful-fs@4.1.15
  │ ├── jsonfile@4.0.0
  │ └── universalify@0.1.2
  ├─┬ hyperquest@2.1.3
  │ ├── buffer-from@0.1.2
  │ ├─┬ duplexer2@0.0.2
  │ │ └─┬ readable-stream@1.1.14
  │ │   ├── isarray@0.0.1
  │ │   └── string_decoder@0.10.31
  │ └─┬ through2@0.6.5
  │   ├── readable-stream@1.0.34
  │   └── xtend@4.0.1
  ├── semver@5.5.1
  ├─┬ tar-pack@3.4.1
  │ ├─┬ debug@2.6.9
  │ │ └── ms@2.0.0
  │ ├─┬ fstream@1.0.11
  │ │ ├── inherits@2.0.3
  │ │ └─┬ mkdirp@0.5.1
  │ │   └── minimist@0.0.8
  │ ├─┬ fstream-ignore@1.0.5
  │ │ └─┬ minimatch@3.0.4
  │ │   └─┬ brace-expansion@1.1.11
  │ │     ├── balanced-match@1.0.0
  │ │     └── concat-map@0.0.1
  │ ├─┬ once@1.4.0
  │ │ └── wrappy@1.0.2
  │ ├─┬ readable-stream@2.3.6
  │ │ ├── core-util-is@1.0.2
  │ │ ├── isarray@1.0.0
  │ │ ├── process-nextick-args@2.0.0
  │ │ ├── safe-buffer@5.1.2
  │ │ ├── string_decoder@1.1.1
  │ │ └── util-deprecate@1.0.2
  │ ├─┬ rimraf@2.6.3
  │ │ └─┬ glob@7.1.3
  │ │   ├── fs.realpath@1.0.0
  │ │   ├── inflight@1.0.6
  │ │   └── path-is-absolute@1.0.1
  │ ├─┬ tar@2.2.1
  │ │ └── block-stream@0.0.9
  │ └── uid-number@0.0.6
  ├─┬ tmp@0.0.33
  │ └── os-tmpdir@1.0.2
  └─┬ validate-npm-package-name@3.0.0
    └── builtins@1.0.3

cabox@BlocChat:~/workspace$ create-react-app BlocChat
/usr/bin/env: ‘node’: No such file or directory
@duola8789

This comment has been minimized.

Copy link

@duola8789 duola8789 commented Feb 27, 2019

谢谢

@nigilan

This comment has been minimized.

Copy link

@nigilan nigilan commented Mar 13, 2019

thanks.

@Mohanmo

This comment has been minimized.

Copy link

@Mohanmo Mohanmo commented Mar 20, 2019

👍

@PedroPinto23

This comment has been minimized.

Copy link

@PedroPinto23 PedroPinto23 commented Mar 26, 2019

THANK YOU BRO

@JoseCigarro

This comment has been minimized.

Copy link

@JoseCigarro JoseCigarro commented Jun 22, 2019

Thank you! Is better to install the new version?

@sapozhkov

This comment has been minimized.

Copy link

@sapozhkov sapozhkov commented Jul 4, 2019

спасибо )

@RandyKdev

This comment has been minimized.

Copy link

@RandyKdev RandyKdev commented Jul 22, 2019

cudos :)

@JeyanthVictory

This comment has been minimized.

Copy link

@JeyanthVictory JeyanthVictory commented Sep 17, 2019

If I want to upgrade the react version (I meant 'version' inside the package.json file), what I am supposed to do?

@bossajie

This comment has been minimized.

Copy link

@bossajie bossajie commented Sep 27, 2019

If I want to upgrade the react version (I meant 'version' inside the package.json file), what I am supposed to do?

change the version of react in your package.json, but make sure that it may affect some of the version of library you used on package.json.

@AlphaGecko

This comment has been minimized.

Copy link

@AlphaGecko AlphaGecko commented Oct 3, 2019

Merci !

@moweiyang0214

This comment has been minimized.

Copy link

@moweiyang0214 moweiyang0214 commented Oct 21, 2019

thanks

@qousarbashir

This comment has been minimized.

Copy link

@qousarbashir qousarbashir commented Dec 11, 2019

thanks

@LeiladosSantos11

This comment has been minimized.

Copy link

@LeiladosSantos11 LeiladosSantos11 commented Dec 16, 2019

Thank you!

@ashwanikumar415

This comment has been minimized.

Copy link

@ashwanikumar415 ashwanikumar415 commented Jan 3, 2020

screenshot 730
why it doesnt create this react folder in desktop instead it creates to some another folder

beacuse -g means you want to install globally

@karthik11c

This comment has been minimized.

Copy link

@karthik11c karthik11c commented Mar 18, 2020

not working for me saying Missing dependencies in package.json

@devindianushika

This comment has been minimized.

Copy link

@devindianushika devindianushika commented Mar 22, 2020

thanks it worked

@chamber-dot

This comment has been minimized.

Copy link

@chamber-dot chamber-dot commented Mar 30, 2020

not working with this command please guide me
npm install -g create-react-app
create-react-app my-app
Screenshot (41)

@yasinkor5

This comment has been minimized.

Copy link

@yasinkor5 yasinkor5 commented Apr 17, 2020

Many many thanks

@JASIM16027

This comment has been minimized.

Copy link

@JASIM16027 JASIM16027 commented Apr 18, 2020

could you help me plz? I have been trying since 4 days but I failed to solve this problem .it will be pleasure for me .
e

@amarpkt

This comment has been minimized.

Copy link

@amarpkt amarpkt commented May 5, 2020

I am new in IT sector and am learning docker.
I came across the react-app and to install this i ran the below command.
Pleas let me weather it is correctly installed or not:

$ npx create-react-app frontend
npx: installed 98 in 34.168s

Creating a new React app in E:\frontend.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

core-js@2.6.11 postinstall E:\frontend\node_modules\babel-runtime\node_modules\core-js
node -e "try{require('./postinstall')}catch(e){}"

core-js@3.6.5 postinstall E:\frontend\node_modules\core-js
node -e "try{require('./postinstall')}catch(e){}"

core-js-pure@3.6.5 postinstall E:\frontend\node_modules\core-js-pure
node -e "try{require('./postinstall')}catch(e){}"

  • react-dom@16.13.1
  • react-scripts@3.4.1
  • react@16.13.1
  • cra-template@1.0.3
    added 1613 packages from 750 contributors and audited 931430 packages in 532.389s

58 packages are looking for funding
run npm fund for details

found 1 low severity vulnerability
run npm audit fix to fix them, or npm audit for details

Initialized a git repository.

Installing template dependencies using npm...
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

  • @testing-library/jest-dom@4.2.4
  • @testing-library/react@9.5.0
  • @testing-library/user-event@7.2.1
    added 36 packages from 56 contributors and audited 931636 packages in 54.223s

58 packages are looking for funding
run npm fund for details

found 1 low severity vulnerability
run npm audit fix to fix them, or npm audit for details
Removing template package using npm...

npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

removed 1 package and audited 931635 packages in 23.603s

58 packages are looking for funding
run npm fund for details

found 1 low severity vulnerability
run npm audit fix to fix them, or npm audit for details
Git commit not created Error: Command failed: git commit -m "Initialize project using Create React App"
at checkExecSyncError (child_process.js:630:11)
at execSync (child_process.js:666:15)
at tryGitCommit (E:\frontend\node_modules\react-scripts\scripts\init.js:62:5)
at module.exports (E:\frontend\node_modules\react-scripts\scripts\init.js:334:25)
at [eval]:3:14
at Script.runInThisContext (vm.js:120:20)
at Object.runInThisContext (vm.js:311:38)
at Object. ([eval]-wrapper:10:26)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at evalScript (internal/process/execution.js:94:25) {
status: 128,
signal: null,
output: [ null, null, null ],
pid: 5560,
stdout: null,
stderr: null
}
Removing .git directory...

Success! Created frontend at E:\frontend
Inside that directory, you can run several commands:

npm start
Starts the development server.

npm run build
Bundles the app into static files for production.

npm test
Starts the test runner.

npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

cd frontend
npm start

Happy hacking!

AmarPc@DESKTOP-9CIBEN7 MINGW64 /e

@muhammadtayyabgujjar

This comment has been minimized.

Copy link

@muhammadtayyabgujjar muhammadtayyabgujjar commented Jun 5, 2020

Thanks

@NoahPerez

This comment has been minimized.

Copy link

@NoahPerez NoahPerez commented Jun 21, 2020

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

"babel-loader": "8.1.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:

/Users/noahperez/node_modules/babel-loader (version: 8.0.6)

Manually installing incompatible versions is known to cause hard-to-debug issues.

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exact order:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
  2. Delete node_modules in your project folder.
  3. Remove "babel-loader" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

  1. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
    This may help because npm has known issues with package hoisting which may get resolved in future versions.

  2. Check if /Users/noahperez/node_modules/babel-loader is outside your project directory.
    For example, you might have accidentally installed something in your home folder.

  3. Try running npm ls babel-loader in your project folder.
    This will tell you which other package (apart from the expected react-scripts) installed babel-loader.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.

P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-testing-again@0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-testing-again@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! /Users/noahperez/.npm/_logs/2020-06-21T11_49_43_601Z-debug.log
noahperez@Noahs-MacBook-Air my-testing-again %

@muhammadtayyabgujjar

This comment has been minimized.

Copy link

@muhammadtayyabgujjar muhammadtayyabgujjar commented Jun 22, 2020

@Anu-123-gif

This comment has been minimized.

Copy link

@Anu-123-gif Anu-123-gif commented Jun 28, 2020

use "sudo" in both the commands on ubuntu for them to work (I faced this issue),thanks!

@developerarif55

This comment has been minimized.

Copy link

@developerarif55 developerarif55 commented Jul 6, 2020

i am also facing this problem after install react app

events.js:292
throw er; // Unhandled 'error' event
^

Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000/"' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output abov

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Arif\AppData\Roaming\npm-cache_logs\2020-07-06T04_51_26_637Z-debug.log
PS C:\Users\Arif\my-app>

@muhammadDaffaa

This comment has been minimized.

Copy link

@muhammadDaffaa muhammadDaffaa commented Sep 3, 2020

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.