我输入了npm install
并出现以下错误:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for duplexer2@^0.2.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'multipipe'
npm ERR! notarget
我查看了日志,发现multipipe是emotion-server
的依赖项,它是我项目中的顶级依赖项:
50 silly saveTree ├─┬ emotion-server@9.2.12
50 silly saveTree │ └─┬ create-emotion-server@9.2.12
...
50 silly saveTree │ │ └── object-keys@0.4.0
50 silly saveTree │ ├── multipipe@1.0.2
足够公平。开始怀疑为什么多管道会指定一个不存在的依赖关系,但事实证明multipipe@1.0.2
从未指定duplexer2@^0.2.0
。这是multipipe@1.0.2
的package.json:
{
"name": "multipipe",
"version": "1.0.2",
"description": "pipe streams with centralized error handling",
"license": "MIT",
"repository": "juliangruber/multipipe",
"dependencies": {
"duplexer2": "^0.1.2",
"object-assign": "^4.1.0"
},
"devDependencies": {
"mocha": "^3.0.0",
"through2": "^2.0.0"
},
"scripts": {
"test": "make test"
}
}
如您所见,它请求的duplexer2
最高为0.1.2(我认为这是对^的正确解释)。
有趣的是,duplexer @ 0.2.0(不是duplexer 2 @ 0.2.0)是react-dev-utils的依赖项:
50 silly saveTree │ ├─┬ react-dev-utils@4.2.3
50 silly saveTree │ │ ├── detect-port-alt@1.1.3
...
50 silly saveTree │ │ ├─┬ gzip-size@3.0.0
50 silly saveTree │ │ │ └── duplexer@0.2.0
因此,也许npm有点困惑,但是我无法真正证明这一点……我只是想让npm获取正确的依赖关系。 (节点v 11.5.0上的npm v6.4.1)
更新
我从package.json中删除了emotion-server
,并做了npm install --cache /tmp/empty-cache
并遇到了类似的问题:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for websocket-extensions@>=0.2.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'websocket-driver'
日志显示websocket-driver@0.7.0
:
59 silly saveTree │ │ ├─┬ faye-websocket@0.11.1
59 silly saveTree │ │ │ └─┬ websocket-driver@0.7.0
好,但是websocket-driver@0.7.0的package.json对于websocket扩展名说'> = 0.1.1',但从未说过“ websocket-extensions @> = 0.2.0”
@> =是我以前从未见过的,没有任何意义。有什么作用?
答案 0 :(得分:1)
这不是对^
的正确理解。规则^0.1.2
表示主要版本应为0
,次要补丁版本应至少为 1.2
,但之后的任何内容也可以。有效的>= 0.1.2
受限于主要版本必须为0
。
- 主要版本零(0.y.z)用于初始开发。随时可能发生任何变化。公共API不应被认为是稳定的。
如果要查看程序包的完整依赖关系树,请查看https://www.npmjs.com/package/npm-remote-ls,以了解真正的责任。对于多管道运行它,在任何地方都没有提到duplexer@0.2.0,因此,如果您认为这是npm中的错误,除了在此处发布问题外,还可以在https://github.com/npm/npm/issues上的npm问题跟踪器中提交问题