Firebase部署在tsc命令处返回错误 [英] Firebase deploy returns error at tsc command
问题描述
我已经设置了一个Firebase项目来创建一些基本的Firebase函数.
在项目中,我正在使用TypeScript
I've setup a Firebase project to create some basic Firebase Functions.
In the project I'm using TypeScript
按照 Firebase官方文档,我创建了我的项目.
Following the Firebase official documentation I created my project.
最后一步firebase deploy --only functions
使用tsc
命令给出了错误.
The last step, firebase deploy --only functions
, gave an error with the tsc
command.
$ firebase deploy --only functions
=== Deploying to ‘my-project’…
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint /path/to/functions
> tslint --project tsconfig.json
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build /path/to/functions
> tsc
node_modules/firebase-functions/lib/function-builder.d.ts(60,95): error TS1005: ';' expected.
node_modules/firebase-functions/lib/function-builder.d.ts(60,96): error TS1003: Identifier expected.
node_modules/firebase-functions/lib/function-builder.d.ts(60,116): error TS1005: ';' expected.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ build 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! /some/path/.npm/_logs/2019-02-03T00_10_30_573Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code2
Having trouble? Try firebase deploy --help
似乎某些Firebase库代码未通过tsc
编译/传输步骤.
我正在寻找使该部署步骤通过的方法.
It seems that some of the Firebase library code does not pass the tsc
compile/transpile step.
I'm looking for a way to make this deploy step pass.
我遵循了此GitHub问题中给出的建议,其中包括:
I've followed the suggestion given at this GitHub issue, which included:
- 将
--skipLibCheck
添加到tsc
命令 - 将
skipLibCheck
添加到项目的生成的functions/tsconfig.json
- 将
isolateModules
添加到functions/tsconfig.json
- 在
functions/tsconfig.json
文件中的typeRoots
数组中添加./functions/node_modules/@types
. - 在
functions/tsconfig.json
中的compilerOptions.lib
中添加dom
- Adding
--skipLibCheck
to thetsc
command - Adding
skipLibCheck
to the project's generatedfunctions/tsconfig.json
- Adding
isolateModules
tofunctions/tsconfig.json
- Adding
./functions/node_modules/@types
to thetypeRoots
array in thefunctions/tsconfig.json
file. - Adding
dom
tocompilerOptions.lib
infunctions/tsconfig.json
以上所有步骤对我都没有作用.
None of the above steps have worked for me.
如何才能成功部署到Firebase?
How can I make my deployment to Firebase succeed?
推荐答案
遇到同样的问题,在将Typescript库升级到3.3.1版本并进行npm安装后,便能够进行部署.
Ran into same issue, was able to deploy after upgrading typescript library to 3.3.1 version and do npm install.
在package.json文件集中 "devDependencies":{ "tslint":〜5.8.0", 打字稿":〜3.3.1" }
In package.json file set "devDependencies": { "tslint": "~5.8.0", "typescript": "~3.3.1" },
注意:您可以删除帖子中描述的所有更改.
Note: you can remove all changes described in your post.
这篇关于Firebase部署在tsc命令处返回错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!