nodejs 開發之二 npm install 安裝依賴包


1. 執行 npm install ,

 

C:\Program Files\nodejs\MyBook>npm install
npm notice created a lockfile as package-lock.json. You should commit this file.

npm WARN mybook@1.0.0 No repository field.

up to date in 2.282s
found 0 vulnerabilities

2. 依賴包被安裝到了 node_modules . 同時生成package-lock.json文件.

package-lock.jsaon 文件內容:

{
"name": "mybook",
"version": "1.0.0",
"lockfileVersion": 1
}

3. 安裝項目需要的buffer包 npm install buffer 和 ignore

C:\Program Files\nodejs\MyBook>npm install buffer

npm WARN mybook@1.0.0 No repository field.

+ buffer@5.6.0
added 3 packages from 4 contributors and audited 3 packages in 5.157s
found 0 vulnerabilities

C:\Program Files\nodejs\MyBook>npm install ignore
npm WARN mybook@1.0.0 No repository field.

+ ignore@5.1.8
added 1 package from 1 contributor and audited 4 packages in 1.695s
found 0 vulnerabilities

自動生成了node_modules.

 

 

 

4.同時更新了: package-lock.json和Package.json文件:

{
  "name": "mybook",
  "version": "1.0.0",
  "description": "My book shelf",
  "main": "index.js",
  "scripts": {
    "test": "node app.js"
  },
  "author": "author",
  "license": "ISC",
  "dependencies": {
    "ignore": "^5.1.8"
  },
  "devDependencies": {
    "buffer": "^5.6.0"
  }
}

  

{
  "name": "mybook",
  "version": "1.0.0",
  "lockfileVersion": 1,
  "requires": true,
  "dependencies": {
    "base64-js": {
      "version": "1.3.1",
      "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
      "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
      "dev": true
    },
    "buffer": {
      "version": "5.6.0",
      "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
      "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
      "dev": true,
      "requires": {
        "base64-js": "^1.0.2",
        "ieee754": "^1.1.4"
      }
    },
    "ieee754": {
      "version": "1.1.13",
      "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
      "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==",
      "dev": true
    },
    "ignore": {
      "version": "5.1.8",
      "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz",
      "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw=="
    }
  }
}

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM