无法在节点 0.10.x 中安装 dev-dependency 错误:找不到兼容版本:

问题描述

我正在尝试运行一个旧节点项目,节点版本为“0.10.x”,npm 版本为“1.4.x”。 我创建了一个 nodeenv,其 node 版本为 0.10.9,npm 版本为 1.2.24

该项目的开发依赖项为 "load-grunt-tasks": "~0.6.0"

但是当我尝试使用 npm install load-grunt-tasks@~0.6.0 安装 npm 时,我收到以下错误

npm ERR! Error: No compatible version found: multimatch@'^0.3.0'
npm ERR! Valid install targets:
npm ERR! ["0.1.0","0.2.0","0.3.0","1.0.0","1.0.1","2.0.0","2.1.0","3.0.0","4.0.0","5.0.0"]
npm ERR!     at installTargetsError (/mnt/c/Users/harsh/OneDrive/Documents/ONITO/software-services/hcare/OphthalmoCare-development/env-0.10/lib/node_modules/npm/lib/cache.js:709:10)
npm ERR!     at /mnt/c/Users/harsh/OneDrive/Documents/ONITO/software-services/hcare/OphthalmoCare-development/env-0.10/lib/node_modules/npm/lib/cache.js:631:10
npm ERR!     at saved (/mnt/c/Users/harsh/OneDrive/Documents/ONITO/software-services/hcare/OphthalmoCare-development/env-0.10/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:138:7)
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help,you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 4.4.0-19041-Microsoft
npm ERR! command "/mnt/c/Users/harsh/OneDrive/Documents/ONITO/software-services/hcare/OphthalmoCare-development/env-0.10/bin/node" "/mnt/c/Users/harsh/OneDrive/Documents/ONITO/software-services/hcare/OphthalmoCare-development/env-0.10/bin/npm" "install" "load-grunt-tasks@~0.6.0"
npm ERR! cwd /mnt/c/Users/harsh/OneDrive/Documents/ONITO/software-services/hcare/OphthalmoCare-development
npm ERR! node -v v0.10.9
npm ERR! npm -v 1.2.24
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /mnt/c/Users/harsh/OneDrive/Documents/ONITO/software-services/hcare/OphthalmoCare-development/npm-debug.log
npm ERR! not ok code 0

或者有时依赖错误被替换为

npm ERR! Error: No compatible version found: findup-sync@'^0.1.2'
npm ERR! Valid install targets:
npm ERR! ["0.1.0","0.1.1","0.1.2","0.1.3","0.2.1","0.4.0","0.4.1","0.4.2","0.4.3","4.0.0"]

解决方法

load-grunt-tasks 的 0.6.0 版本已经有 7 年历史了,所以还是建议升级它。

有趣/奇怪的是,它认为没有兼容的版本,即使它确实给出了一个版本列表,包括一个应该兼容的版本。由于使用像 1.2.24 这样的旧 NPM 版本,这可能是一个错误,因为这似乎是 reported before