NodeJS 에서 package. json 해석

7759 단어
package. json 에는 각종 필요 한 모듈 과 프로젝트 의 설정 정보 (이름, 버 전, 허가증 등) meta 정보 가 포함 되 어 있 습 니 다.
설정 가능 한 항목 포함
  • name
  • 응용 설명
  • 버 전 번호 버 전
  • 응 용 된 설정 항목 config
  • 저자 author
  • 자원 창고 주소 respository
  • 권한 수여 방식 licenses
  • 디렉토리 디렉토리
  • 응용 입구 파일 main
  • 명령 행 파일 bin
  • 프로젝트 응용 운행 의존 모듈 dependencies
  • 프로젝트 응용 개발 환경 의존 devDependencies
  • 엔진 엔진 운행
  • 스 크 립 트 스 크 립 트
  • 단순 모드
    ==========================
    {   
    
        name: "myApp", version :"0.0.1" }

    전체 모드
    ===========================
    {
    
      "name": "myApp",  "version": "0.0.0",  "author" : "simple",  "description" : "Nodejs Package json  ",  "keywords" : "javascript, nodejs",  "respository" : {   "type" :"git",   "url" :"http://path/to/url"  },  "bugs" : {   "url" : "http://path/to/bug",   "email" : "[email protected]"  },  "contributors" : [  {"name" : "zhangsan", "email" : "[email protected]"  ]  "license" : "MIT",  "engines" : { "node" : "0.10.x"},  "script" : {   "start" : "node index.js"  },  "private": true,  "scripts": {  "start": "node ./bin/www"  },  "dependencies": {   "express": "~4.9.0",   "body-parser": "~1.8.1",   "cookie-parser": "~1.3.3",   "morgan": "~1.3.0",   "serve-favicon": "~2.1.3",  "debug": "~2.0.0",   "jade": "~1.6.0"  },  "devDependencies": {   "bower" : "~1.2.8",   "grunt" : "~0.4.1",   "grunt-contrib-concat" : "~0.3.0",   "grunt-contrib-jshint" : "~0.7.2",   "grunt-contrib-uglify" : "~0.2.7",   "grunt-contrib-clean" : "~0.5.0",   "browserify" : "2.36.1",   "grunt-browserify" : "~1.3.0"  } }

    1.scripts
    지정 한 스 크 립 트 명령 을 실행 합 니 다.
    2.
    npm install express –save
    npm install express –save-dev
    위의 코드 는 express 모듈 을 단독으로 설치 하 는 것 을 표시 합 니 다.
    – save 매개 변 수 는 이 모듈 을 dependencies 속성 에 기록 하 는 것 을 표시 합 니 다.
    – save - dev 는 이 모듈 을 devDependencies 속성 에 기록 하 는 것 을 표시 합 니 다.
    3. 지 정 된 버 전 번호 에 대하 여
    (1) 파도 번호 ~ (tilde) + 지정 버 전: 예 를 들 어 ~ 1.2.2 는 1.2. x 를 설치 한 최신 버 전 (1.2.2 보다 낮 지 않 음) 을 표시 하지만 1.3. x 를 설치 하지 않 습 니 다. 즉, 설치 할 때 큰 버 전과 부차적인 버 전 번 호 를 바 꾸 지 않 습 니 다.

    좋은 웹페이지 즐겨찾기