ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • npm
    web 2022. 4. 25. 09:55

    npm

    Node Package Manager

     

    - 노드의 패키지 매니저

    - 다른 사람들이 만든 소스 코드들을 모아둔 저장소

    - 오픈 소스 생태계

    - 이미 있는 기능을 다시 구현할 필요가 없어 효율적

     

    package

    :npm에 업로드된 노드 모듈

     

     

     

    npm init - package.json 만들기

    package.json 생성

    npm -v (버전확인)

     

    npm run test (에러를 발생시키고 종료하는 코드)

    npm i express (오픈소스 서버 설치)

    npm i cookie-parser body-parser (각종 패키지 설치)

    npm i -D nodemon (각종 패키지 설치)

     

    dependencies - 배포할때까지 사용되는 패키지

    devDependencies - 개발할때만 사용되는 패키지

    {
      "name": "npmtest",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "start": "node index"
      },
      "author": "sehwan",
      "license": "MIT",
      "dependencies": { // 배포할떄까지 사용되는 패키지
        "body-parser": "^1.20.0",
        "cookie-parser": "^1.4.6",
        "express": "^4.17.3"
      },
      "devDependencies": { // 개발할때만 사용되는 패키지
        "nodemon": "^2.0.15"
      }
    }

     

Designed by Tistory.