npm 依赖项不满足(即使它们应该满足?)
Posted
技术标签:
【中文标题】npm 依赖项不满足(即使它们应该满足?)【英文标题】:npm dependencies not satisfied (even though they should be?) 【发布时间】:2016-07-27 08:22:31 【问题描述】:我觉得我必须在这里忽略一些东西。
尝试在现有项目上运行 npm install 时,我收到以下错误(来自 npm-debug.log):
76 error Windows_NT 6.1.7601
77 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
78 error node v4.4.2
79 error npm v2.15.0
80 error code EPEERINVALID
81 error peerinvalid The package grunt@0.4.2 does not satisfy its siblings' peerDependencies requirements!
81 error peerinvalid Peer grunt-concurrent@0.4.3 wants grunt@~0.4.0
81 error peerinvalid Peer grunt-contrib-sass@0.8.1 wants grunt@>=0.4.0
81 error peerinvalid Peer grunt-autoprefixer@2.0.0 wants grunt@~0.4.2
81 error peerinvalid Peer grunt-webfont@0.5.4 wants grunt@~0.4.0
81 error peerinvalid Peer grunt-purifycss@0.1.1 wants grunt@~0.4.5
82 verbose exit [ 1, true ]
据我所知,grunt@0.4.2 应该满足所有这些依赖项。
来自this *** question,我的理解是这些包依赖于以下内容:
grunt-concurrent@0.4.3 想要 grunt@~0.4.0(即 grunt@0.4.*) grunt-contrib-sass@0.8.1 想要 grunt@>=0.4.0 grunt-autoprefixer@2.0.0 想要 grunt@~0.4.2(即 grunt@0.4.*) grunt-webfont@0.5.4 想要 grunt@~0.4.0(即 grunt@0.4.*) 对等的 grunt-purifycss@0.1.1 想要 grunt@~0.4.5(即 grunt@0.4.*)grunt@0.4.2 应该匹配所有这些依赖项,但 npm 说它不匹配并且安装失败。有什么我忽略的吗?
根据要求,我的 package.json 文件:
"name": "glasses-1",
"siteUrl": "http://www.glasses.com/",
"version": "0.0.1",
"dependencies":
"adaptivejs": "1.3.0",
"connect": "2.3.4",
"grunt": "0.4.2",
"grunt-concurrent": "0.4.3",
"mocha": "1.14.0",
"chai": "1.9.0",
"lodash": "~2.4.1",
"grunt-contrib-sass": "0.8.1",
"grunt-autoprefixer": "2.0.0"
,
"devDependencies":
"grunt": "^0.4.5",
"grunt-purifycss": "^0.1.0",
"grunt-sass": "^1.1.0",
"grunt-webfont": "^0.5.1",
"gulp-sass": "^2.1.0"
,
"description": "This repository contains the code for the glasses-1 Adaptive.js project.",
"main": "Gruntfile.js",
"directories":
"test": "tests"
,
"scripts":
"test": "mocha"
,
"author": "",
"license": "ISC"
【问题讨论】:
能否分享一下 package.json 文件? 我已将其编辑到原始帖子中。谢谢! 【参考方案1】:81 error peerinvalid Peer grunt-purifycss@0.1.1 wants grunt@~0.4.5
从倒数第二行开始
所以你需要 grunt@0.4.5 而不是 0.4.2
【讨论】:
你说得对——我误解了波浪号的工作原理。谢谢!以上是关于npm 依赖项不满足(即使它们应该满足?)的主要内容,如果未能解决你的问题,请参考以下文章
npm 错误!如何使用 vue@2.6.14 安装满足对等依赖的编译器-sfc?