firebase云功能部署错误-错误TS6133
我只是在尝试firebase云功能。index.ts只是一个你好的世界。但是我在部署firebase云函数时出错了 我只是从这里开始学习视频教程: 这是索引firebase云功能部署错误-错误TS6133,firebase,google-cloud-functions,Firebase,Google Cloud Functions,我只是在尝试firebase云功能。index.ts只是一个你好的世界。但是我在部署firebase云函数时出错了 我只是从这里开始学习视频教程: 这是索引 import * as functions from 'firebase-functions'; // Start writing Firebase Functions // https://firebase.google.com/docs/functions/typescript export const helloWorld = f
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!");
});
这是我的package.json
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"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"
},
"engines": {
"node": "8"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^8.0.0",
"firebase-functions": "^3.1.0"
},
"devDependencies": {
"tslint": "^5.12.0",
"typescript": "^3.2.2"
},
"private": true
}
我该怎么办?我怀疑您在部署之前没有保存源文件。在磁盘上,该函数可能仍被注释掉,这将导致
函数未被使用。问题在于新版本的typscript,只需从tsconfig.json“NonuUsedLocals”中禁用此属性:false
]
}
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"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"
},
"engines": {
"node": "8"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^8.0.0",
"firebase-functions": "^3.1.0"
},
"devDependencies": {
"tslint": "^5.12.0",
"typescript": "^3.2.2"
},
"private": true
}
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": false,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017"
},
"compileOnSave": true,
"include": [
"src"