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 commented Jan 27, 2018

thanks

@js2me

This comment has been minimized.

Copy link

js2me commented Feb 1, 2018

thank you

@SaurabhGarg1

This comment has been minimized.

Copy link

SaurabhGarg1 commented Feb 3, 2018

thanks. That helps

@bendonlang

This comment has been minimized.

Copy link

bendonlang commented Feb 3, 2018

Thanks

@0x0006e

This comment has been minimized.

Copy link

0x0006e commented Feb 7, 2018

well done

@shereej

This comment has been minimized.

Copy link

shereej commented Feb 9, 2018

thank you

@eladonline

This comment has been minimized.

Copy link

eladonline commented Feb 27, 2018

thank you !

@elcordova

This comment has been minimized.

Copy link

elcordova commented Feb 28, 2018

gracias

@PetKatt

This comment has been minimized.

Copy link

PetKatt commented Mar 1, 2018

Gracia Plenna!

@muchamateusz

This comment has been minimized.

Copy link

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 commented Mar 10, 2018

bless.

@nyanjongandrew

This comment has been minimized.

Copy link

nyanjongandrew commented Mar 16, 2018

Thanks

@ms-vague

This comment has been minimized.

Copy link

ms-vague commented Mar 19, 2018

Thank you.

@TylerSustare

This comment has been minimized.

Copy link

TylerSustare commented Mar 26, 2018

Tanks braddah

@filip-dot-cube

This comment has been minimized.

Copy link

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 commented Apr 7, 2018

yeah this is helpful. Awesome!

@Narvey

This comment has been minimized.

Copy link

Narvey commented Apr 18, 2018

why was this created as a secret gist?

@princecharming519

This comment has been minimized.

Copy link

princecharming519 commented May 25, 2018

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

@Suil3File

This comment has been minimized.

Copy link

Suil3File commented May 28, 2018

Nice

@gautam-patadiya

This comment has been minimized.

Copy link

gautam-patadiya commented Jun 7, 2018

Thanks!

@rymo90

This comment has been minimized.

Copy link

rymo90 commented Jun 9, 2018

thanks !

@sulemankhan447

This comment has been minimized.

Copy link

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 commented Jun 26, 2018

Appreciated :)

@Iwi4a

This comment has been minimized.

Copy link

Iwi4a commented Jul 12, 2018

Мерси!

@ClarkLusm

This comment has been minimized.

Copy link

ClarkLusm commented Jul 17, 2018

Thanks!!!

@arduino731

This comment has been minimized.

Copy link

arduino731 commented Jul 22, 2018

no wonder thanks

@molochnyk

This comment has been minimized.

Copy link

molochnyk commented Jul 27, 2018

wow, Thanks )

@yang29

This comment has been minimized.

Copy link

yang29 commented Jul 28, 2018

Good stuff

@abodesigner

This comment has been minimized.

Copy link

abodesigner commented Jul 28, 2018

Everything works well, thanks

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 2, 2018

Thanks :)

@Sokcho05

This comment has been minimized.

Copy link

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 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 commented Sep 26, 2018

Thanks!

@T0nyKo

This comment has been minimized.

Copy link

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 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 commented Oct 25, 2018

Дякую!

@manishn19

This comment has been minimized.

Copy link

manishn19 commented Nov 12, 2018

Thanks it works :)

@Felix-okeff

This comment has been minimized.

Copy link

Felix-okeff commented Dec 11, 2018

wow! It worked.
Thanks alot

@giserman001

This comment has been minimized.

Copy link

giserman001 commented Dec 29, 2018

good job

@navyblueyes

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

Suil3File commented Feb 14, 2019

Thank

@duola8789

This comment has been minimized.

Copy link

duola8789 commented Feb 27, 2019

谢谢

@nigilan

This comment has been minimized.

Copy link

nigilan commented Mar 13, 2019

thanks.

@Mohanmo

This comment has been minimized.

Copy link

Mohanmo commented Mar 20, 2019

👍

@PedroPinto23

This comment has been minimized.

Copy link

PedroPinto23 commented Mar 26, 2019

THANK YOU BRO

@JoseCigarro

This comment has been minimized.

Copy link

JoseCigarro commented Jun 22, 2019

Thank you! Is better to install the new version?

@sapozhkov

This comment has been minimized.

Copy link

sapozhkov commented Jul 4, 2019

спасибо )

@RandyKdev

This comment has been minimized.

Copy link

RandyKdev commented Jul 22, 2019

cudos :)

@JeyanthVictory

This comment has been minimized.

Copy link

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 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 commented Oct 3, 2019

Merci !

@moweiyang0214

This comment has been minimized.

Copy link

moweiyang0214 commented Oct 21, 2019

thanks

@qousarbashir

This comment has been minimized.

Copy link

qousarbashir commented Dec 11, 2019

thanks

@LeiladosSantos11

This comment has been minimized.

Copy link

LeiladosSantos11 commented Dec 16, 2019

Thank you!

@ashwanikumar415

This comment has been minimized.

Copy link

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 commented Mar 18, 2020

not working for me saying Missing dependencies in package.json

@devindianushika

This comment has been minimized.

Copy link

devindianushika commented Mar 22, 2020

thanks it worked

@chamber-dot

This comment has been minimized.

Copy link

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 commented Apr 17, 2020

Many many thanks

@JASIM16027

This comment has been minimized.

Copy link

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

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.