user977828
user977828

Reputation: 7679

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:

- [email protected] node_modules/mongodb/node_modules/bson
[email protected] /home/lorencm/Downloads/mongo-invoices
└─┬ [email protected] 
  ├── [email protected] 
  ├─┬ [email protected] 
  │ ├── [email protected] 
  │ └─┬ [email protected] 
  │   ├── [email protected] 
  │   └── [email protected] 
  └─┬ [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
└── [email protected]

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 [email protected] and instead installs [email protected]:

{
  "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 <[email protected]>",
  "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
- [email protected] node_modules/bson
- [email protected] node_modules/core-util-is
- [email protected] node_modules/es6-promise
- [email protected] node_modules/inherits
- [email protected] node_modules/isarray
- [email protected] node_modules/resolve-from
- [email protected] node_modules/semver
- [email protected] node_modules/require_optional
- [email protected] node_modules/mongodb-core
- [email protected] node_modules/string_decoder
- [email protected] node_modules/readable-stream
[email protected] /home/lorencm/Downloads/mongo-invoices
└─┬ [email protected] 
  └── [email protected]

Why will it not install the version I specified in the package.json?

Upvotes: 0

Views: 818

Answers (1)

gnerkus
gnerkus

Reputation: 12037

The application fails to install the 2.1.6 version because of a npm-shrinkwrap.json file which:

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

Upvotes: 1

Related Questions