gpt4 book ai didi

javascript - package.json 中的 Node 引擎 8.x 或 10.x

转载 作者:IT老高 更新时间:2023-10-28 22:12:48 24 4
gpt4 key购买 nike

我尝试在 package.json 中指定 Node 引擎以同时接受 810 版本。

我试着输入这个:

"engines": {
"node": "8.x|10.x"
},

但运行 yarn 会导致:

The engine "node" is incompatible with this module. Expected version "8.x|10.x"

如果我替换为:

"engines": {
"node": "10.x"
},

...它可以工作(即没有错误)。

有没有办法在 package.json 中接受两个版本的 Node 引擎?

最佳答案

您只需要双管道 || 而不是单管道。

"engines": {
"node": "^8 || ^10"
}

将匹配 v8.x.x 或 v10.x.x 但 v9。

您可以阅读更多信息 here , 或 https://github.com/npm/node-semver#versions

关于javascript - package.json 中的 Node 引擎 8.x 或 10.x,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51596127/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com