Firebase CLI 部署警告:Node.js 8 运行时已弃用,将于 2020-12-05 停用
Firebase CLI deployment warning: The Node.js 8 runtime is deprecated and will be decommissioned on 2020-12-05
我正在尝试学习如何将打字稿部署到我的 FCF 上,但它似乎没有像文档和 firecasts 的官方视频中那样进行部署。当我尝试部署我的默认代码 helloworld 而不是 typescript 时,它正在部署 node.js 文件,我不明白为什么?下面是一些 json 文件和 ts 文件,请查看生成的文件。
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017"
},
"compileOnSave": true,
"include": [
"src"
]
}
package.json
{
"name": "functions",
"scripts": {
"lint": "./node_modules/.bin/tslint -p tslint.json",
"build": "./node_modules/.bin/tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^8.10.0",
"firebase-functions": "^3.6.0"
},
"devDependencies": {
"tslint": "^5.12.0",
"typescript": "^3.2.2",
"firebase-functions-test": "^0.2.0"
},
"private": true
}
index.ts
import * as functions from 'firebase-functions';
// Start writing Firebase Functions
// https://firebase.google.com/docs/functions/typescript
export const helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
最后是部署代码时的结果:
=== Deploying to 'gym-system-63a51'...
i deploying functions
Running command: npm --prefix functions run build
> functions@ build C:\Users\FX504GE-EN179T\Desktop\Clustore_App\MapboxTest\TypeScript\functions
> tslint -p tslint.json && tsc
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint C:\Users\FX504GE-EN179T\Desktop\Clustore_App\MapboxTest\TypeScript\functions
> tslint -p tslint.json
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build C:\Users\FX504GE-EN179T\Desktop\Clustore_App\MapboxTest\TypeScript\functions
> tslint -p tslint.json && tsc
+ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
! functions: The Node.js 8 runtime is deprecated and will be decommissioned on 2020-12-05. For more information, see: https://firebase.google.com/support/faq#functions-runtime
+ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (29.86 KB) for uploading
+ functions: functions folder uploaded successfully
i functions: updating Node.js 8 function helloWorld(us-central1)...
+ functions[helloWorld(us-central1)]: Successful update operation.
+ Deploy complete!
我有预感package.json是引擎的原因?但我不知道我应该用什么数字更新它。谢谢!
节点 8 运行时已弃用,将停止使用。关注link in the warning message for more information. You will need to migrate to node 10 eventually。至少,您需要确保在 package.json:
中进行了设置
"engines": {
"node": "10"
},
我正在尝试学习如何将打字稿部署到我的 FCF 上,但它似乎没有像文档和 firecasts 的官方视频中那样进行部署。当我尝试部署我的默认代码 helloworld 而不是 typescript 时,它正在部署 node.js 文件,我不明白为什么?下面是一些 json 文件和 ts 文件,请查看生成的文件。
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017"
},
"compileOnSave": true,
"include": [
"src"
]
}
package.json
{
"name": "functions",
"scripts": {
"lint": "./node_modules/.bin/tslint -p tslint.json",
"build": "./node_modules/.bin/tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^8.10.0",
"firebase-functions": "^3.6.0"
},
"devDependencies": {
"tslint": "^5.12.0",
"typescript": "^3.2.2",
"firebase-functions-test": "^0.2.0"
},
"private": true
}
index.ts
import * as functions from 'firebase-functions';
// Start writing Firebase Functions
// https://firebase.google.com/docs/functions/typescript
export const helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
最后是部署代码时的结果:
=== Deploying to 'gym-system-63a51'...
i deploying functions
Running command: npm --prefix functions run build
> functions@ build C:\Users\FX504GE-EN179T\Desktop\Clustore_App\MapboxTest\TypeScript\functions
> tslint -p tslint.json && tsc
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint C:\Users\FX504GE-EN179T\Desktop\Clustore_App\MapboxTest\TypeScript\functions
> tslint -p tslint.json
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build C:\Users\FX504GE-EN179T\Desktop\Clustore_App\MapboxTest\TypeScript\functions
> tslint -p tslint.json && tsc
+ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
! functions: The Node.js 8 runtime is deprecated and will be decommissioned on 2020-12-05. For more information, see: https://firebase.google.com/support/faq#functions-runtime
+ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (29.86 KB) for uploading
+ functions: functions folder uploaded successfully
i functions: updating Node.js 8 function helloWorld(us-central1)...
+ functions[helloWorld(us-central1)]: Successful update operation.
+ Deploy complete!
我有预感package.json是引擎的原因?但我不知道我应该用什么数字更新它。谢谢!
节点 8 运行时已弃用,将停止使用。关注link in the warning message for more information. You will need to migrate to node 10 eventually。至少,您需要确保在 package.json:
中进行了设置 "engines": {
"node": "10"
},