firebase 云功能引擎节点与此模块不兼容
firebase cloud funtions the engine node is incompatible with this module
我创建了一个 firebase 云函数项目,默认添加了以下依赖项和以下引擎:
"dependencies": {
"firebase-admin": "^8.0.0",
"firebase-functions": "^3.1.0"
},
"engines": {
"node": "8"
}
每当我 运行 yarn add
我得到以下错误和未添加依赖项:
error firebase-admin@8.4.0: The engine "node" is incompatible with this module. Expected version "^8.13.0 || >=10.10.0". Got "8.11.4"
然后我尝试将节点引擎版本更改为 10 "engines": {"node": "10"}
,但是当我 yarn add 时出现以下错误:
error functions@: The engine "node" is incompatible with this module. Expected version "10". Got "8.11.4"
如何解决这个问题?
可能您需要将此添加到您的 package.json
"engines": {
"node": "8" // or "10"
}
Github issue 解决了您遇到的问题。总而言之,您可以:
- 运行
yarn config set ignore-engines true
- 确保
node -v
和 npm -v
中的版本与 package.json
中列出的版本匹配,如果不匹配,请更新以匹配预期版本
使用 nvm 以便您可以使用不同版本的节点。
安装后您可以看到所有可用的版本:
$ nvm ls-remote
v0.1.14
v0.1.15
v0.1.16
v0.1.17
v0.1.18
...
v12.13.1
v13.0.0
v13.0.1
v13.1.0
v13.2.0
然后安装你需要的版本。例如,对于版本 8:
$ nvm i 8
Downloading https://nodejs.org/dist/v8.16.2/node-v8.16.2-linux-x64.tar.xz...
######################################################################## 100,0%
WARNING: checksums are currently disabled for node.js v4.0 and later
Now using node v8.16.2 (npm v6.4.1)
测试:
$ node -v
v8.16.2
我创建了一个 firebase 云函数项目,默认添加了以下依赖项和以下引擎:
"dependencies": {
"firebase-admin": "^8.0.0",
"firebase-functions": "^3.1.0"
},
"engines": {
"node": "8"
}
每当我 运行 yarn add
我得到以下错误和未添加依赖项:
error firebase-admin@8.4.0: The engine "node" is incompatible with this module. Expected version "^8.13.0 || >=10.10.0". Got "8.11.4"
然后我尝试将节点引擎版本更改为 10 "engines": {"node": "10"}
,但是当我 yarn add 时出现以下错误:
error functions@: The engine "node" is incompatible with this module. Expected version "10". Got "8.11.4"
如何解决这个问题?
可能您需要将此添加到您的 package.json
"engines": {
"node": "8" // or "10"
}
Github issue 解决了您遇到的问题。总而言之,您可以:
- 运行
yarn config set ignore-engines true
- 确保
node -v
和npm -v
中的版本与package.json
中列出的版本匹配,如果不匹配,请更新以匹配预期版本
使用 nvm 以便您可以使用不同版本的节点。
安装后您可以看到所有可用的版本:
$ nvm ls-remote
v0.1.14
v0.1.15
v0.1.16
v0.1.17
v0.1.18
...
v12.13.1
v13.0.0
v13.0.1
v13.1.0
v13.2.0
然后安装你需要的版本。例如,对于版本 8:
$ nvm i 8
Downloading https://nodejs.org/dist/v8.16.2/node-v8.16.2-linux-x64.tar.xz...
######################################################################## 100,0%
WARNING: checksums are currently disabled for node.js v4.0 and later
Now using node v8.16.2 (npm v6.4.1)
测试:
$ node -v
v8.16.2