简体   繁体   English

Firebase 函数是否不支持 Node 18 作为其 Package.json 文件中的引擎参数?

[英]Does Firebase Function Does not Support Node 18 as its Engine parameter in Package.json file?

Does firebase function supports node 18 version as its engine parameters in package.json file. firebase 函数是否支持 node 18 版本作为 package.json 文件中的引擎参数。 I am getting error as " Error: package.json in functions directory has an engines field which is unsupported. Valid choices are: {"node": 10|12|14|16}" when i used Node 18 as engine parameter.我收到错误消息,因为“错误:函数目录中的 package.json 有一个不受支持的引擎字段。有效的选择是:{“节点”:10|12|14|16}”当我使用节点 18 作为引擎参数时。

I tried to use node 18 in engine parameter field as我尝试在引擎参数字段中使用节点 18 作为

  "engines": {
    "node": "18"
  },

my package.json looks like this:我的 package.json 看起来像这样:

{
  "name": "functions",
  "scripts": {
    "build": "webpack --mode production",
    "watch": "webpack --watch --mode development",
    "serve": "npm run build && firebase serve --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log",
    "test": "jest",
    "lint": "tslint --project tsconfig.json",
    "fmt": "prettier --config '../.prettierrc' --write 'src/**/*.{tsx,ts}'"
  },
  "engines": {
    "node": "18"
  },
  "main": "dist/index.js",
  "dependencies": {
    "@bugsnag/js": "^7.10.1",
    "@google-cloud/storage": "^5.18.2",
    "@google-cloud/tasks": "2.5.0",
    "@slack/web-api": "^5.7.0",
    "@types/axios": "^0.14.0",
    "@types/express": "^4.16.1",
    "@types/node": "^13.1.7",
    "async-sema": "3.0.1",
    "axios": "^0.26.1",
    "body-parser": "^1.18.3",
    "date-fns": "1.30.1",
    "date-fns-timezone": "^0.1.4",
    "delay": "4.3.0",
    "express": "^4.16.4",
    "express-basic-auth": "1.2.0",
    "firebase-admin": "^8.13.0",
    "firebase-functions": "^3.19.0",
    "fp-ts": "^1.18.2",
    "freee-firebase-sdk": "^2.0.6",
    "freee-logger": "git+https://github.com/freee/freee-logger.git",
    "http": "^0.0.0",
    "maskdata": "^1.1.6",
    "node-cache": "^5.1.0",
    "nodemailer": "^6.7.2",
    "nodemailer-sendgrid-transport": "0.2.0",
    "oauth": "^0.9.15",
    "ramda": "^0.26.1",
    "simple-oauth2": "^2.2.1",
    "url": "0.11.0",
    "json-bigint": "^1.0.0",
    "lodash": "^4.17.21",
    "minimist": "^1.2.6",
    "node-forge": "^1.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.14.6",
    "@babel/preset-env": "^7.14.7",
    "@types/jest": "^26.0.0",
    "babel-loader": "^8.2.2",
    "firebase-functions-test": "^0.1.6",
    "jest": "^26.0.0",
    "jest-cli": "^26.0.0",
    "omega-js": "git+ssh://git@github.com/C-FO/omega-js.git#v1.0.1",
    "prettier": "^2.4.1",
    "ts-jest": "^26.0.0",
    "ts-loader": "^5.4.3",
    "tslint": "^5.12.0",
    "typescript": "^4.5.4",
    "webpack": "^4.46.0",
    "webpack-cli": "^3.3.12",
    "webpack-node-externals": "^2.5.0"
  },
  "private": true
}

The documentation at Set Node.js version says: Set Node.js 版本的文档说:

Firebase SDK for Cloud Functions 2.0.0 and higher allows a selection of Node.js runtime. Firebase SDK for Cloud Functions 2.0.0 及更高版本允许选择 Node.js 运行时。 You can choose to run all functions in a project exclusively on the runtime environment corresponding to one of these supported Node.js versions:您可以选择在与这些受支持的 Node.js 版本之一相对应的运行时环境中专门运行项目中的所有功能:

  • Node.js 18节点 18
  • Node.js 16节点 16
  • Node.js 14节点 14

Upgrade your Node.js runtime升级您的 Node.js 运行时

To upgrade your Node.js runtime:要升级您的 Node.js 运行时:

Make sure your project is on the Blaze pricing plan.确保您的项目在 Blaze 定价计划中。

  • Make sure you are using Firebase CLI v9.17.0 or later.确保您使用的是 Firebase CLI v9.17.0 或更高版本。
  • Change the engines value in the package.json file that was created in your functions/ directory during initialization.更改初始化期间在 functions/ 目录中创建的 package.json 文件中的引擎值。 For example, if you are upgrading from version 16 to version 18, the entry should look like this: "engines": {"node": "18"}例如,如果您要从版本 16 升级到版本 18,条目应如下所示: "engines": {"node": "18"}
  • Optionally, test your changes using the Firebase Local Emulator Suite.或者,使用 Firebase Local Emulator Suite 测试您的更改。
  • Redeploy functions using the Firebase CLI v11.18.0 or later.使用 Firebase CLI v11.18.0 或更高版本重新部署函数。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 google node api 是否支持部署管理器函数调用? - Does google node api support deployment manager function calls? 找不到 package.json。 Node.js 可能有启动问题。 验证 package.json 是否有效或将代码放在名为 server.js 或 app.js 的文件中 - Failed to find package.json. Node.js may have issues starting. Verify package.json is valid or place code in a file named server.js or app.js Firebase 是否支持 AdServices.framework? - Does Firebase support AdServices.framework? Is go.mod in Go the same thing as package.json in JavaScript (node)? - Is go.mod in Go the same thing as package.json in JavaScript (node)? hypertune package 中的“report_hyperparameter_tuning_metric”function 中的“global_step”参数指的是什么? - What does the 'global_step' parameter refer to from the 'report_hyperparameter_tuning_metric' function in the hypertune package? firebase电话认证是否支持支持国家的所有移动运营商? - Does firebase phone authentication support all mobile operators of supported country? 如何在 GitLab CI/CD 上碰撞 package.json 版本的项目? - How to bump package.json version of project on GitLab CI/CD? Firebase function 尝试写入 firebase 存储“Firebase 存储:用户无权访问”时出错 - Firebase function getting error when trying to write to firebase storage "Firebase Storage: User does not have permission to access" 为什么我的 Firebase function 成功发出 API 请求,但随后超时 - Why does my Firebase function successfully make an API request, but then timeout 如何检查该字段在Firebase中是否存在,如果存在则打印其值,如果不存在则在Flutter中添加一个空值 - How to check whether the field exists in Firebase, if it exists then print its value, if it does not exist, then add it with an empty value in Flutter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM