Firebase部署在tsc命令处返回错误 [英] Firebase deploy returns error at tsc command

查看:76
本文介绍了Firebase部署在tsc命令处返回错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个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 the tsc command
  • Adding skipLibCheck to the project's generated functions/tsconfig.json
  • Adding isolateModules to functions/tsconfig.json
  • Adding ./functions/node_modules/@types to the typeRoots array in the functions/tsconfig.json file.
  • Adding dom to compilerOptions.lib in functions/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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆