node.js 설치

Programming/Node.js 2021. 7. 18. 15:18 Posted by 파란크리스마스

node.js (https://nodejs.org/ko/download/)

압축파일 node-v14.17.3-win-x64.zip 다운 받아서 C:\usr\local\node-v14.17.3-win-x64 폴더에 압축 풀기

경로 추가 : C:\usr\local\node-v14.17.3-win-x64

npm 버전 확인

C:\Users\bluesanta>npm -v
6.14.13

yarn 설치

C:\Users\bluesanta>npm install -g yarn

> yarn@1.22.10 preinstall C:\usr\local\node-v14.17.3-win-x64\node_modules\yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

C:\usr\local\node-v14.17.3-win-x64\yarn -> C:\usr\local\node-v14.17.3-win-x64\node_modules\yarn\bin\yarn.js
C:\usr\local\node-v14.17.3-win-x64\yarnpkg -> C:\usr\local\node-v14.17.3-win-x64\node_modules\yarn\bin\yarn.js
+ yarn@1.22.10
added 1 package in 0.603s

pm2 설치

C:\Users\bluesanta>npm install -g pm2
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
C:\usr\local\node-v14.17.3-win-x64\pm2-dev -> C:\usr\local\node-v14.17.3-win-x64\node_modules\pm2\bin\pm2-dev
C:\usr\local\node-v14.17.3-win-x64\pm2-docker -> C:\usr\local\node-v14.17.3-win-x64\node_modules\pm2\bin\pm2-docker
C:\usr\local\node-v14.17.3-win-x64\pm2 -> C:\usr\local\node-v14.17.3-win-x64\node_modules\pm2\bin\pm2
C:\usr\local\node-v14.17.3-win-x64\pm2-runtime -> C:\usr\local\node-v14.17.3-win-x64\node_modules\pm2\bin\pm2-runtime
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\pm2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ pm2@5.1.0
added 180 packages from 203 contributors in 13.736s

pdf-markup 설치

C:\usr\local\pdf-markup\app>yarn install
yarn install v1.22.10
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 31.97s.

서버 구동

일반적인 구동

C:\usr\local\pdf-markup\app>yarn start
yarn run v1.22.10
$ node .
Example app listening at http://localhost:8080

디버깅 구동 (--inspect)

C:\usr\local\pdf-markup\app>yarn debug
yarn run v1.22.10
$ node --inspect .
Debugger listening on ws://127.0.0.1:9229/ea7a5c4e-bc3e-49f7-af03-8eef874d4281
For help, see: https://nodejs.org/en/docs/inspector
Example app listening at http://localhost:8080

pm2 를 이용한 무중단 서비스 구동

C:\usr\local\pdf-markup\app>pm2 start .

                        -------------

__/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
 _\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___
  _\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__
   _\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___
    _\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____
     _\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________
      _\/\\\_____________\/\\\_____________\/\\\___/\\\/___________
       _\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_
        _\///______________\///______________\///__\///////////////__


                          Runtime Edition

        PM2 is a Production Process Manager for Node.js applications
                     with a built-in Load Balancer.

                Start and Daemonize any application:
                $ pm2 start app.js

                Load Balance 4 instances of api.js:
                $ pm2 start api.js -i 4

                Monitor in production:
                $ pm2 monitor

                Make pm2 auto-boot at server restart:
                $ pm2 startup

                To go further checkout:
                http://pm2.io/


                        -------------

[PM2] Spawning PM2 daemon with pm2_home=C:\Users\bluesanta\.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting C:\usr\local\cmx_home\pdf-markup\app in fork_mode (1 instance)
[PM2] Done.
┌─────┬──────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼──────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ .    │ default     │ 1.0.0   │ fork    │ 12320    │ 0s     │ 0    │ online    │ 0%       │ 50.2mb   │ blu… │ disabled │
└─────┴──────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘

C:\usr\local\cmx_home\pdf-markup\app>pm2 start .

댓글을 달아 주세요