如何忽略不兼容的引擎“节点"使用纱线安装 npm 依赖项时出错? [英] How to ignore incompatible engine "node" error on installing npm dependencies with yarn?
本文介绍了如何忽略不兼容的引擎“节点"使用纱线安装 npm 依赖项时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
鉴于此 package.json
:
{
"name": "yarn-install-fail",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {},
"author": "",
"license": "ISC",
"dependencies": {
"aws-sdk": "2.x.x",
"s3-streams": "^0.3.0"
}
}
我可以通过 npm 成功安装依赖项:
I can install the dependencies successfully via npm:
$ npm install
added 27 packages in 1.844s
然而纱线失败了:
$ yarn install
yarn install v0.24.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
error s3-streams@0.3.0: The engine "node" is incompatible with this module. Expected version "^1.2.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
似乎yarn 在安装库 s3-streams@0.3.0
时遇到问题,但我认为它会像 npm
那样安装所有依赖项.
It appears yarn has trouble installing the library s3-streams@0.3.0
, yet I assumed it would fallback to install all the dependencies anyway like npm
would.
推荐答案
您确实可以通过 --ignore-engines:
$ yarn install --ignore-engines
yarn install v0.24.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 1.41s.
这也记录在命令的帮助中:
This is also documented in the command's help:
$ yarn help | grep -- --ignore
--ignore-scripts don't run lifecycle scripts
--ignore-platform ignore platform checks
--ignore-engines ignore engines check
--ignore-optional ignore optional dependencies
这篇关于如何忽略不兼容的引擎“节点"使用纱线安装 npm 依赖项时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文