package.json?

Yeon Jeffrey Seo·2021년 9월 26일
0

개발 상식

목록 보기
1/4

package.json?

npm init을 하면 작업 디렉터리에 package.json이라는 파일이 생긴다.

package.json 파일에는 현재 프로젝트에 관련된 메타데이터가 담긴다. 프로젝트의 정보, 프로젝트에서 사용중인 패키지와 그 버전 등 ..

{
  "type": "module",
  "name": "project",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bcrypt": "^5.0.1",
    "ejs": "^3.1.6",
    "express": "^4.17.1",
    "mongoose": "^6.0.7",
    "nodemon": "^2.0.13"
  }
}

만약 node_modules 폴더가 사라진다던지, 협업 상황에서 모듈 버전을 통일 시킬 때 꽤 유용하게 쓰인다.
package.json에 dependencies만 있다면, 사용할 모듈을 한번에 쉽게 설치할 수 있다.

$ npm i
$ npm install

profile
The best time to plant a tree was twenty years ago. The second best time is now.

0개의 댓글