【问题标题】:Unable to run npm install successfully due to unmet peer dependencies由于未满足对等依赖关系,无法成功运行 npm install
【发布时间】:2016-03-25 10:58:46
【问题描述】:

我有 package.json 文件,其中提到了以下 devDependencies:

"devDependencies": {
    "bower": "^1.7.7",
    "connect-ssi": "^1.1.0",
    "grunt": "~0.4.5",
    "grunt-contrib-compass": "^1.1.0",
    "grunt-contrib-concat": "~0.4.0",
    "grunt-contrib-connect": "^0.11.2",
    "grunt-contrib-handlebars": "^0.11.0",
    "grunt-contrib-jshint": "~0.10.0",
    "grunt-contrib-qunit": "~0.5.2",
    "grunt-contrib-sass": "^0.9.2",
    "grunt-contrib-uglify": "~0.5.0",
    "grunt-contrib-watch": "~0.6.1",
    "grunt-jsdoc": "^1.1.0",
    "karma": "^0.13.22",
    "karma-jasmine": "^0.3.7"
  }

现在,当我运行 npm install 时,它会出现以下错误:

未满足的同行依赖 jasmine-core@* npm WARN EPEERINVALID karma-jasmine@0.3.8 需要 jasmine-core@* 的对等体,但没有安装。 npm WARN EPACKAGEJSON hidebuddy-prototype@0.0.1 没有存储库字段。

hirebuddy-prototype 是 package.json 中的名称。

运行npm install 会安装package.json 中提到的所有依赖项,还是需要分别安装jasmine-corekarma-jasmine

【问题讨论】:

    标签: json node.js gruntjs


    【解决方案1】:

    这是业力茉莉的弱点。在其 package.json 中,jasmine-core 被列为 peerDependency,NPM 3 不再自动安装这些。所以你必须在你自己的 package.json 中添加jasmine-core。所以只需npm install jasmine-core --save-dev,并祈祷最新版本是兼容的。应该是的。

    信息:http://blog.npmjs.org/post/110924823920/npm-weekly-5

    【讨论】:

    • 感谢@dannyjolie,现在它没有显示 jasmine-core 和 karma-jasmine 的错误,但我有另一个问题:现在当我运行“grunt”命令时,它会抛出错误:运行“compass:dist” (指南针)任务警告:未找到:指南针使用 --force 继续。我的 package.json 中有“grunt-contrib-compass 依赖项”,并且 node_modules 中也显示了相同的文件夹。我有 gruntfile.js 和一个 compass 任务,我正在提供插件:grunt.loadNpmTasks('grunt -contrib-compass') 与 taskrunner: grunt.registerTask('default', ['connect:development', 'compass','watch']).
    • @ApaarBhatnagar 这一切都在文档中:github.com/gruntjs/grunt-contrib-compass 引用:“此任务需要您安装 Ruby、Sass 和 Compass >=1.0.1。”
    • 为我工作。非常感谢。 .
    猜你喜欢
    • 1970-01-01
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多