Hi I have encountered the following error while installing npm package mongoose-auto-increment and mongoose-simpledb both globally and locally.
The Error are as follows
mongoose-auto-increment
npm WARN peerDependencies The peer dependency mongoose@~4.0.0 included from mongoose-auto-increment will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "mongoose-auto-increment"
npm ERR! node v0.12.4
npm ERR! npm v2.11.2
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package mongoose does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants mongoose@~4.0.0
npm ERR! Please include the following file with any support request:
npm ERR! /Users/febinp/Downloads/Shubham_application/Project/npm-debug.log
mongoose-simpledb
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "mongoose-simpledb"
npm ERR! node v0.12.4
npm ERR! npm v2.11.2
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package mongoose does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants mongoose@~4.0.0
npm ERR! peerinvalid Peer [email protected] wants mongoose@~3.8.18
npm ERR! Please include the following file with any support request:
npm ERR! /Users/febinp/Downloads/Shubham_application/Project/npm-debug.log
My Package.json
is as follows
{
"name": "Project",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"keywords": [],
"dependencies": {
"async": "^1.4.0",
"ejs": "~0.8.4",
"grunt": "0.4.2",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-jst": "~0.6.0",
"grunt-contrib-less": "0.11.1",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-sails-linker": "~0.9.5",
"grunt-sync": "~0.0.4",
"include-all": "~0.1.3",
"mongoose": "^4.1.0",
"mongoose-acl": "^0.2.3",
"mongoose-unique-validator": "^0.4.1",
"passport-local-mongoose": "^1.0.1",
"rc": "~0.5.0",
"sails": "~0.11.0",
"sails-disk": "~0.10.0"
},
"scripts": {
"debug": "node debug app.js",
"start": "node app.js"
},
"main": "app.js",
"repository": {
"type": "git",
"url": "git://github.com/febinp/ZATASA.git"
},
"author": "XYZ",
"license": ""
}
Can somebody help me as to why I am getting this error and what is the workaround?
In your package.json
mongoose have a higher version 4.0.0. But mongoose-simpledb
wants mongoose@~3.8.18.
mongoose-simpledb
includes it's dependency mongoose-auto-increment
. If you explicitly declare the _id field on your schema as type Number then simpledb will automatically invoke the mongoose-auto-increment plugin for that model.
Example from documentation itself:
exports.schema = {
_id: Number, // Causes simpledb to auto-increment _id for new documents.
creator: { type: Number, ref: 'User' }
};
I have tried changing the package.json to this and it worked:
{
"name": "Project",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"keywords": [],
"dependencies": {
"async": "^1.4.0",
"ejs": "~0.8.4",
"grunt": "0.4.2",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-jst": "~0.6.0",
"grunt-contrib-less": "0.11.1",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-sails-linker": "~0.9.5",
"grunt-sync": "~0.0.4",
"include-all": "~0.1.3",
"mongoose": "~3.8.18",
"mongoose-simpledb": "~4.0.3",
"mongoose-acl": "^0.2.3",
"mongoose-unique-validator": "^0.4.1",
"passport-local-mongoose": "^1.0.1",
"rc": "~0.5.0",
"sails": "~0.11.0",
"sails-disk": "~0.10.0"
},
"scripts": {
"debug": "node debug app.js",
"start": "node app.js"
},
"main": "app.js",
"repository": {
"type": "git",
"url": "git://github.com/febinp/ZATASA.git"
},
"author": "XYZ",
"license": ""
}