简体   繁体   English

package.json中指定的Mongodb版本无法安装

[英]Mongodb version specified in package.json fails to install

If I do npm install mongodb , the desired version of mongodb is installed without a problem: 如果我执行npm install mongodb ,则可以毫无问题地安装所需的mongodb版本:

- bson@0.1.5 node_modules/mongodb/node_modules/bson
mongo-invoices@0.0.0 /home/lorencm/Downloads/mongo-invoices
└─┬ mongodb@2.1.6 
  ├── es6-promise@3.0.2 
  ├─┬ mongodb-core@1.3.1 
  │ ├── bson@0.4.21 
  │ └─┬ require_optional@1.0.0 
  │   ├── resolve-from@2.0.0 
  │   └── semver@5.1.0 
  └─┬ readable-stream@1.0.31 
├── core-util-is@1.0.2 
├── inherits@2.0.1 
├── isarray@0.0.1 
└── string_decoder@0.10.31

As soon as I have all my dependencies in package.json stored (see below) and I use npm install it fails (see below) to install mongodb@2.1.6 and instead installs mongodb@1.1.11 : 一旦我将所有依赖项存储在package.json中(请参阅下文),并且我使用npm install它就会安装mongodb@2.1.6失败(请参阅下文),而是安装mongodb@1.1.11

{
  "name": "mongo-invoices",
  "version": "0.0.0",
  "description": "open-source invoice system build on node.js and mongodb",
  "main": "app.js",
  "dependencies": {
"accounting": "~0.4.1",
"bcrypt-nodejs": "0.0.3",
"emailjs": "~1.0.2",
"express": "~4.13.4",
"i18n": "^0.6.0",
"jade": "~1.11.0",
"moment": "~2.11.2",
"mongodb": "~2.1.6",
"stylus": "~0.53.0"
  },
  "devDependencies": {},
  "scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
"type": "git",
"url": "git://github.com/gianlucadelgobbo/mongo-invoices.git"
  },
  "keywords": [
"invoices",
"mongodb",
"node.js"
  ],
  "author": "Gianluca Del Gobbo <g.delgobbo@flyer.it>",
  "license": "BSD",
  "readmeFilename": "README.md",
  "private": true
}

.

make[1]: *** [Release/obj.target/bson/ext/bson.o] Error 1
make[1]: Leaving directory `/home/lorencm/Downloads/mongo-invoices/node_modules/mongodb/node_modules/bson/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.2.0-23-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/lorencm/Downloads/mongo-invoices/node_modules/mongodb/node_modules/bson
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
make: *** [node_gyp] Error 1
child process exited with code 2
- bson@0.4.21 node_modules/bson
- core-util-is@1.0.2 node_modules/core-util-is
- es6-promise@3.0.2 node_modules/es6-promise
- inherits@2.0.1 node_modules/inherits
- isarray@0.0.1 node_modules/isarray
- resolve-from@2.0.0 node_modules/resolve-from
- semver@5.1.0 node_modules/semver
- require_optional@1.0.0 node_modules/require_optional
- mongodb-core@1.3.1 node_modules/mongodb-core
- string_decoder@0.10.31 node_modules/string_decoder
- readable-stream@1.0.31 node_modules/readable-stream
mongo-invoices@0.0.0 /home/lorencm/Downloads/mongo-invoices
└─┬ mongodb@1.1.11 
  └── bson@0.1.5

Why will it not install the version I specified in the package.json ? 为什么不安装我在package.json指定的版本?

The application fails to install the 2.1.6 version because of a npm-shrinkwrap.json file which: 由于npm-shrinkwrap.json文件,该应用程序无法安装2.1.6版本:

This command locks down the versions of a package's dependencies so that you can control exactly which versions of each dependency will be used when your package is installed. 此命令锁定软件包依赖项的版本,以便您可以精确控制安装软件包时将使用每个依赖项的版本。

If you inspect the npm-shrinkwrap.json for mongo-invoices , you'll find the specified version for mongodb is 1.1.11 如果检查npm-shrinkwrap.json中的mongo-invoices ,则会发现mongodb的指定版本为1.1.11

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM