B.2.5 init 명령어
앞에서 실행한 install과 remove에서 ‘npm WARN enoent ENOENT: no such file or directory, open …… package.json’ 같은 경고 메시지를 확인할 수 있었습니다. 이는 package.json 파일이 없기 때문에 발생하는 경고 메시지입니다. package.json은 현재 소프트웨어가 참조하는 확장 모듈들의 목록을 관리해 배포하기 쉽도록 도와주는 파일입니다.
npm init 명령어를 이용해 package.json 파일을 생성하겠습니다.
npm init 명령어
> 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 json
for definitive documentation on these fields
and exactly what they do.
Use npm install <pkg> --save
afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (microservice) microservice
version: (1.0.0) 1.0.0
description: test
git repository: git
keywords: test keyword
author: microservice
license: (ISC)
About to write to C:\Users\jdc\package.json:
{
“name”: “microservice”,
“version”: “1.0.0”,
“description”: “test”,
“main”: “index.js”,
“dependencies”: {},
“devDependencies”: {},
“scripts”: {
“test”: “echo \“Error: no test specified\” && exit 1”
},
“author”: “microservice”,
“license”: “ISC”,
“repository”: {
“type”: “git”,
“url”: “git”
},
“keywords”: [
“test”,
“keyword”
]
}
Is this ok? (yes) yes