react
설치 (npm install -g create-react-app
)
일단 설치하고.. sudo
와 같이 입력해야한다.
jinia@jin:~/Documents/GitHub/hello-world/src/react$ sudo npm install -g create-react-app
[sudo] password for jinia:
/usr/local/bin/create-react-app -> /usr/local/lib/node_modules/create-react-app/index.js
+ create-react-app@1.4.3
added 106 packages in 6.274s
jinia@jin:~/Documents/GitHub/hello-world/src/react$
jinia@jin:~/Documents/GitHub/hello-world/src/react$ create-react-app -h
Usage: create-react-app <project-directory> [options]
Options:
-V, --version output the version number
--verbose print additional logs
--scripts-version <alternative-package> use a non-standard version of react-scripts
-h, --help output usage information
Only <project-directory> is required.
A custom --scripts-version can be one of:
- a specific npm version: 0.8.2
- a custom fork published on npm: my-react-scripts
- a .tgz archive: https://mysite.com/my-react-scripts-0.8.2.tgz
It is not needed unless you specifically want to use a fork.
If you have any problems, do not hesitate to file an issue:
https://github.com/facebookincubator/create-react-app/issues/new
jinia@jin:~/Documents/GitHub/hello-world/src/react$ create-react-app -V
1.4.3
jinia@jin:~/Documents/GitHub/hello-world/src/react$
jinia@jin:~/Documents/GitHub/hello-world/src/react$ create-react-app my-app
Creating a new React app in /home/jinia/Documents/GitHub/hello-world/src/react/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
> uglifyjs-webpack-plugin@0.4.6 postinstall /home/jinia/Documents/GitHub/hello-world/src/react/my-app/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
+ react-dom@16.2.0
+ react@16.2.0
+ react-scripts@1.0.17
added 1152 packages in 59.449s
Success! Created my-app at /home/jinia/Documents/GitHub/hello-world/src/react/my-app
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 my-app
npm start
Happy hacking!
jinia@jin:~/Documents/GitHub/hello-world/src/react$
jinia@jin:~/Documents/GitHub/hello-world/src/react$ cd my-app
jinia@jin:~/Documents/GitHub/hello-world/src/react/my-app$ ls -al
total 524
drwxr-xr-x 5 jinia jinia 4096 Dec 21 10:59 .
drwxr-xr-x 3 jinia jinia 4096 Dec 21 10:58 ..
-rw-r--r-- 1 jinia jinia 285 Dec 21 10:59 .gitignore
drwxr-xr-x 895 jinia jinia 36864 Dec 21 10:59 node_modules
-rw-r--r-- 1 jinia jinia 343 Dec 21 10:59 package.json
-rw-r--r-- 1 jinia jinia 357409 Dec 21 10:59 package-lock.json
drwxr-xr-x 2 jinia jinia 4096 Dec 21 10:59 public
-rw-r--r-- 1 jinia jinia 108987 Dec 21 10:59 README.md
drwxr-xr-x 2 jinia jinia 4096 Dec 21 10:59 src
jinia@jin:~/Documents/GitHub/hello-world/src/react/my-app$ ls -al public src
public:
total 20
drwxr-xr-x 2 jinia jinia 4096 Dec 21 10:59 .
drwxr-xr-x 5 jinia jinia 4096 Dec 21 10:59 ..
-rw-r--r-- 1 jinia jinia 3870 Dec 21 10:59 favicon.ico
-rw-r--r-- 1 jinia jinia 1590 Dec 21 10:59 index.html
-rw-r--r-- 1 jinia jinia 317 Dec 21 10:59 manifest.json
src:
total 36
drwxr-xr-x 2 jinia jinia 4096 Dec 21 10:59 .
drwxr-xr-x 5 jinia jinia 4096 Dec 21 10:59 ..
-rw-r--r-- 1 jinia jinia 377 Dec 21 10:59 App.css
-rw-r--r-- 1 jinia jinia 524 Dec 21 10:59 App.js
-rw-r--r-- 1 jinia jinia 208 Dec 21 10:59 App.test.js
-rw-r--r-- 1 jinia jinia 63 Dec 21 10:59 index.css
-rw-r--r-- 1 jinia jinia 254 Dec 21 10:59 index.js
-rw-r--r-- 1 jinia jinia 2671 Dec 21 10:59 logo.svg
-rw-r--r-- 1 jinia jinia 4021 Dec 21 10:59 registerServiceWorker.js
jinia@jin:~/Documents/GitHub/hello-world/src/react/my-app$
참고 https://www.youtube.com/watch?v=-AbaV3nrw6E&list=PL6gx4Cwl9DGBuKtLgPR_zWYnrwv-JllpA