您好我在全局和本地安装npm package mongoose-auto-increment和mongoose-simpledb时遇到以下错误。
错误如下
猫鼬-自动递增
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 mongoose-auto-increment@4.0.0 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
猫鼬-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 mongoose-auto-increment@4.0.0 wants mongoose@~4.0.0
npm ERR! peerinvalid Peer mongoose-simpledb@4.0.3 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
我的Package.json
如下
{
"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": ""
}
有人可以帮我解释为什么我会收到此错误以及解决方法是什么?
答案 0 :(得分:2)
在package.json
猫鼬中有更高版本4.0.0。但是mongoose-simpledb
想要mongoose @〜3.8.18。
mongoose-simpledb
包含它的依赖关系mongoose-auto-increment
。如果在架构上显式声明_id字段为Number类型,那么simpledb将自动为该模型调用mongoose-auto-increment插件。
文档本身的示例:
exports.schema = {
_id: Number, // Causes simpledb to auto-increment _id for new documents.
creator: { type: Number, ref: 'User' }
};
我尝试将package.json更改为此功能并且有效:
{
"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": ""
}