gpt4 book ai didi

node.js - 安装 mongoose-auto-increment 和 mongoose-simpledb 时出现 npm 错误代码 EPEERINVALID

转载 作者:可可西里 更新时间:2023-11-01 10:28:01 26 4
gpt4 key购买 nike

您好,我在全局和本地安装 npm 包 mongoose-auto-increment 和 mongoose-simpledb 时遇到了以下错误。

报错如下

Mongoose 自动增量

   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

Mongoose 简单数据库

   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": ""
}

有人可以帮助我了解为什么会出现此错误以及解决方法是什么吗?

最佳答案

  1. 在您的 package.json Mongoose 有一个更高的版本 4.0.0。但是 mongoose-simpledb 需要 mongoose@~3.8.18。

  2. 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": ""
}

关于node.js - 安装 mongoose-auto-increment 和 mongoose-simpledb 时出现 npm 错误代码 EPEERINVALID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31654721/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com