草庐IT

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

coder 2023-11-04 原文

您好,我在全局和本地安装 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/

有关node.js - 安装 mongoose-auto-increment 和 mongoose-simpledb 时出现 npm 错误代码 EPEERINVALID的更多相关文章

  1. ruby - ECONNRESET (Whois::ConnectionError) - 尝试在 Ruby 中查询 Whois 时出错 - 2

    我正在用Ruby编写一个简单的程序来检查域列表是否被占用。基本上它循环遍历列表,并使用以下函数进行检查。require'rubygems'require'whois'defcheck_domain(domain)c=Whois::Client.newc.query("google.com").available?end程序不断出错(即使我在google.com中进行硬编码),并打印以下消息。鉴于该程序非常简单,我已经没有什么想法了-有什么建议吗?/Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/base.

  2. ruby - 在 64 位 Snow Leopard 上使用 rvm、postgres 9.0、ruby 1.9.2-p136 安装 pg gem 时出现问题 - 2

    我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po

  3. 使用 ACL 调用 upload_file 时出现 Ruby S3 "Access Denied"错误 - 2

    我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file

  4. ruby - 使用 postgres.app 在 rvm 下要求 pg 时出错 - 2

    我正在使用Postgres.app在OSX(10.8.3)上。我已经修改了我的PATH,以便应用程序的bin文件夹位于所有其他文件夹之前。Rammy:~phrogz$whichpg_config/Applications/Postgres.app/Contents/MacOS/bin/pg_config我已经安装了rvm并且可以毫无错误地安装pggem,但是当我需要它时我得到一个错误:Rammy:~phrogz$gem-v1.8.25Rammy:~phrogz$geminstallpgFetching:pg-0.15.1.gem(100%)Buildingnativeextension

  5. ruby-on-rails - 为什么在安装 Ruby 1.9.3 时出现 404 错误? - 2

    我最近对我的计算机(OS-MacOSX10.6.8)进行了删除,并且我正在重新安装我所有的开发工具。我再次安装了RVM;但是,它不会让我安装Ruby1.9.3。到目前为止我已经尝试过:rvminstall1.9.3rvm安装1.9.3-p194rvm安装1.9.3-p448rvminstall1.9.3--with-gcc=clang所有返回相同的命令行错误:Searchingforbinaryrubies,thismighttakesometime.Nobinaryrubiesavailablefor:osx/10.6/x86_64/ruby-1.9.3-p448.Continuin

  6. objective-c - 在设置 Cocoa Pods 和安装 Ruby 更新时出错 - 2

    我正在尝试为我的iOS应用程序设置cocoapods但是当我执行命令时:sudogemupdate--system我收到错误消息:当前已安装最新版本。中止。当我进入cocoapods的下一步时:sudogeminstallcocoapods我在MacOS10.8.5上遇到错误:ERROR:Errorinstallingcocoapods:cocoapods-trunkrequiresRubyversion>=2.0.0.我在MacOS10.9.4上尝试了同样的操作,但出现错误:ERROR:Couldnotfindavalidgem'cocoapods'(>=0),hereiswhy:U

  7. ruby-on-rails - 使用 Rails 2.3.5 运行 Thinking Sphinx 时出现问题 - 2

    我刚刚安装了Sphinx(发行版:archlinux)并下载了源代码。然后我为Rails安装了“ThinkingSphinx”插件。我关注了officialpagesetup和thisScreencastfromRyanBates,但是当我尝试为模型建立索引时,出现了这个错误:$rakethinking_sphinx:index(in/home/benoror/Dropbox/Proyectos/cotizahoy)Sphinxcannotbefoundonyoursystem.Youmayneedtoconfigurethefollowingsettingsinyourconfig/

  8. ruby - 未定义的方法 auto_upgrade!将 Sinatra/DataMapper 应用程序推送到 Heroku 时 - 2

    有谁知道在Heroku的Bamboo堆栈上启动并运行使用DataMapper的Sinatra应用程序所需的魔法咒语?Bamboo堆栈不包含任何预安装的系统gem,无论我尝试使用何种gem组合,我都会不断收到此错误:undefinedmethod`auto_upgrade!'forDataMapper:Module(NoMethodError)这是我的.gems文件中的内容:sinatrapgdatamapperdo_postgresdm-postgres-adapter这些是我将应用程序推送到Heroku时安装的依赖项:----->Herokureceivingpush----->Si

  9. ruby-on-rails - 使用 HTTP.get_response 检索 Facebook 访问 token 时出现 Rails EOF 错误 - 2

    我试图在我的网站上实现使用Facebook登录功能,但在尝试从Facebook取回访问token时遇到障碍。这是我的代码:ifparams[:error_reason]=="user_denied"thenflash[:error]="TologinwithFacebook,youmustclick'Allow'toletthesiteaccessyourinformation"redirect_to:loginelsifparams[:code]thentoken_uri=URI.parse("https://graph.facebook.com/oauth/access_token

  10. ruby - 尝试运行 minitest 单元测试时出错 - 2

    尝试使用rubytest/test_foo.rb运行minitest单元测试时出现以下错误:Warning:youshouldrequire'minitest/autorun'instead.Warning:oradd'gem"minitest"'before'require"minitest/autorun"'From:/home/emile/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/minitest/autorun.rb:15:```test_foo.rb看起来像这样:require'minitest/autorun'classTestFoo

随机推荐