티스토리 뷰

Programming/Node.js

Node.js 8.x 설치 설치

파란크리스마스 2019. 1. 26. 13:13
728x90

출처

Node.js 8.x 설치

$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Node.js 버전 확인

$ node --version
v8.15.0

Express 설치

$ sudo npm install -g express
+ express@4.16.4
added 48 packages from 36 contributors in 16.445s

Express 애플리케이션 생성기 설치

$ sudo npm install express-generator -g
/usr/bin/express -> /usr/lib/node_modules/express-generator/bin/express-cli.js
+ express-generator@4.16.0
added 10 packages from 13 contributors in 5.69s

Express 애플리케이션 만들기

$ express myapp
 
  warning: the default view engine will not be jade in future releases
  warning: use `--view=jade' or `--help' for additional options
 
 
   create : myapp/
   create : myapp/public/
   create : myapp/public/javascripts/
   create : myapp/public/images/
   create : myapp/public/stylesheets/
   create : myapp/public/stylesheets/style.css
   create : myapp/routes/
   create : myapp/routes/index.js
   create : myapp/routes/users.js
   create : myapp/views/
   create : myapp/views/error.jade
   create : myapp/views/index.jade
   create : myapp/views/layout.jade
   create : myapp/app.js
   create : myapp/package.json
   create : myapp/bin/
   create : myapp/bin/www
 
   change directory:
     $ cd myapp
 
   install dependencies:
     $ npm install
 
   run the app:
     $ DEBUG=myapp:* npm start

Express 애플리케이션 초기화

$ cd myapp
$ sudo npm install
audited 194 packages in 9.077s
found 2 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

Express 애플리케이션 실행

$ DEBUG=myapp:* npm start
 
> myapp@0.0.0 start /home/pi/workspace/myapp
> node ./bin/www
 
  myapp:server Listening on port 3000 +0ms
GET / 200 2337.812 ms - 170
GET /stylesheets/style.css 200 28.972 ms - 111
GET /favicon.ico 404 165.796 ms - 1062

브라우져로 확인

댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함