[Node.js] npm스크립트 npm start

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
32
33
34
35
36
S C:\Users\cas90\Desktop\01-understanding-npm-scripts>      // 이걸누름      npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
 
See `npm help init` for definitive documentation on these fields
and exactly what they do.
 
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
 
Press ^C at any time to quit.
package name: (nodejs-complete-guide)  // 엔터
version: (1.0.0) //엔터
git repository: // 엔터
keywords: //엔터
license: (ISC)
About to write to C:\Users\cas90\Desktop\01-understanding-npm-scripts\package.json:
 
{
  "name""nodejs-complete-guide",
  "version""1.0.0",
  "description""Complete Node.js Guide",
  "main""app.js",
  "scripts": {
    "test""echo \"Error: no test specified\" && exit 1",
    "start""node app.js",
    "start-server""node app.js"
  },
  "author""Maximilian Schwarzmüller",
  "license""ISC"
}
 
 
Is this OK? (yes)
PS C:\Users\cas90\Desktop\01-understanding-npm-scripts> 
 
cs

npm init 

 

 

 

s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "name": "nodejs-complete-guide",
  "version": "1.0.0",
  "description": "Complete Node.js Guide",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
 
    "start": "node app.js",   // 따로 생성해주기 기존에 있는 로직 이면 터미널에 == > npm start 하면 작동됨
 
    "start-server": "node app.js"  // 이건 일반스크립트 구문이기때문 == > npm run start-server 작동  ( npm start-server 작동xx)
 
  },
  "author": "Maximilian Schwarzmüller",
  "license": "ISC"
}
 
 
 
cs

npm start 구문 실행

 

 

 

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
{
  "name""node",
  "version""1.0.0",
  "description""hi",
  "main""server.js",
  "scripts": {
    "test""echo \"Error: no test specified\" && exit 1",
    "start""node server.js"
  },
  "author""",
  "license""ISC",
  "devDependencies": {
    "nodemon""^2.0.16"  //노드몬 버전
  }
}
 
}
 
 
 
PS C:\Users\cas90\Desktop\node.js> npm install nodemon --save-dev
 
added 116 packages, and audited 117 packages in 7s
 
16 packages are looking for funding
  run `npm fund` for details
 
found 0 vulnerabilities
PS C:\Users\cas90\Desktop\node.js> 
cs

npm install --save-dev                                           현재 파일에만설치

npm install -g nodemon                                       // 전체에다가 실행

'🎃 ~23 년 5월 이전 > 🏀Node' 카테고리의 다른 글

[Node.js]미들웨어 작동법. url  (0) 2022.06.08
[Node.js] 미들웨어추가..  (0) 2022.06.07
[Node.js] Express.js 란 ?  (0) 2022.06.07
[Node.js] form 요청  (0) 2022.06.07
[Node.js] 응답 하기 response  (0) 2022.06.07