【发布时间】:2021-03-20 01:38:59
【问题描述】:
我只是按照 firebase 文档 (https://firebase.google.com/docs/functions/typescript) 将我的云功能项目迁移到打字稿,现在,我在使用时出现以下错误:'firebase deploy --only functions'
这里是堆栈跟踪:
deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint (here is my project path)
> tslint -p tslint.json
Invalid option for project: tslint.json
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `tslint -p tslint.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/macbook/.npm/_logs/2020-12-08T17_25_16_433Z-debug.log
我的 tsconfig.json :
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017",
"types": ["node"],
"allowJs": true
},
"compileOnSave": true,
"include": [
"src"
]
}
我的 package.json :
{
"name": "functions",
"main": "./src/index.ts",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "./node_modules/.bin/tslint -p tslint.json",
"build": "./node_modules/.bin/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": "12"
},
"dependencies": {
"cors": "^2.8.5",
"firebase-admin": "^9.4.1",
"firebase-functions": "^3.13.0",
"googleapis": "^39.2.0",
"request": "^2.88.2",
"tslint": "^6.1.3",
"typedi": "^0.8.0",
"typescript": "^4.1.2"
},
"devDependencies": {
"@types/node": "^14.14.10",
"firebase-functions-test": "^0.1.7"
},
"private": true
}
【问题讨论】:
-
我已经尝试了几乎所有可以在谷歌上获得的东西,但我现在的想法真的很低。我无法推进我的项目,如果有人有想法,将不胜感激!
-
能否请您添加您的云功能的代码?这能够复制以了解正在发生的事情。
-
能够按照我的回答中所述使其工作。感谢您的关心!
标签: typescript firebase google-cloud-firestore google-cloud-functions tslint