ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Npm init package.json 생성
    Search: NodeJs NodeJs 2022. 11. 23. 21:39

     

     

    명령어

    npm init
    npm init -y

     

    명령어 실행 화면 Ex
    (프로젝트 정보 입력 or 생략 가능)

    C:\t2>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: (t2) namet222222
    version: (1.0.0) 0.0.2
    description: desccccccc
    entry point: (index.js) index.ts
    test command: node index.js
    git repository:
    keywords:
    author:
    license: (ISC)
    About to write to C:\t2\package.json:
    
    {
      "name": "namet222222",
      "version": "0.0.2",
      "description": "desccccccc",
      "main": "index.ts",
      "scripts": {
        "test": "node index.js"
      },
      "author": "",
      "license": "ISC"
    }
    
    
    Is this OK? (yes)
    
    C:\t2>

    package.json파일이 생성 된다.

     

    만약, test script를 실행하고 싶으면 아래 명령어를 입력하면 등록된 script가 실행된다.

    npm run test

     

     

    package.json

    package.json은 프로젝트의 이름, 버전, 사용되는 모듈 등의 스펙이 정해져 있다.

    package.json만 있다면 해당 오픈 소스가 의존하고 있는 모듈이 어떤 것인지 알 수 있다.

    아래 명령어로 모듈들을 한 번에 설치할 수 있다.

    npm install

     

    'NodeJs' 카테고리의 다른 글

    Npm DevDependencies  (0) 2022.11.26
    Udp data 주고 받기 Ex  (0) 2022.11.25
    Npm 설치된 라이브러리 모듈 목록 조회  (0) 2022.11.23
    Npm install -g 전역 설치  (0) 2022.11.23
    Nodejs Npm  (0) 2022.11.23
    NodeJs Express 설치  (0) 2022.11.20
    NodeJs 기반에서 React 배포  (0) 2022.11.20
    npm install 명령어  (0) 2022.11.20

    댓글