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.
node_modules/gaxios/build/src/index.d.ts(14,66): error TS1005: '>' expected.
node_modules/gaxios/build/src/index.d.ts(14,103): error TS1109: Expression expected.
Related issues
[REQUIRED] Version info
node:
v8.12.0
firebase-functions:
2.2.0 (same error with 2.1.0)
firebase-tools:
6.3.1
firebase-admin:
7.0.0
[REQUIRED] Steps to reproduce
Create an empty firebase TypeScript project and try to compile.
Here's my 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"
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^7.0.0",
"firebase-functions": "^2.2.0"
"devDependencies": {
"tslint": "~5.8.0",
"typescript": "~2.8.3"
"private": true
I found a few problems with this issue:
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
This issue does not seem to follow the issue template. Make sure you provide all the required information.
agordeev, olonge, 4grecycling, DerKapp, askilondz, kevinrodriguez-io, rusrc, idofilus, jwiesmann, marcostomasello, and 8 more reacted with thumbs up emoji
szymonlisiecki, garrettg123, pmdy, fredriccliver, stepek, wdavidcalsin, erald14, AndyGanea, nichitaa, Rihyx, and 9 more reacted with thumbs down emoji
All reactions
ImaginativeShohag, olonge, svzi, DerKapp, khemrajiitk, Alqueraf, brandontle, kevinrodriguez-io, EdricChan03, abejr, and 16 more reacted with thumbs up emoji
rupeshtiwari, luceKang, and gtcdevop reacted with hooray emoji
All reactions
linuxatico, ebouJ, rajaraodv, DerKapp, shuzootani, Serdnad, khemrajiitk, mdanics, TedNIVAN, brandontle, and 45 more reacted with thumbs up emoji
tobiasmuecksch, regikono, szymonlisiecki, jatinb92, iamswain25, gonzalo-lorieto, dastanaron, ismaelgansonre, KR1470R, szhshp, and 14 more reacted with thumbs down emoji
brandontle, onero, orelnatan-zz, Liam212, lordonnance, jesusrg1, avidort, duongtruong12, trakbond, felipeandresrr, and 2 more reacted with hooray emoji
All reactions
agordeev, RicardoFazzi, AmitThakur, ImaginativeShohag, olonge, cesarrosales, DerKapp, shuzootani, askilondz, brandontle, and 10 more reacted with thumbs up emoji
AmitThakur, olonge, chris-hut, Flucadetena, gianmarcog, and shareef99 reacted with laugh emoji
JeongJun-Lee, Flucadetena, and gianmarcog reacted with hooray emoji
All reactions
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! C:\Users\Ruben Palavecino\AppData\Roaming\npm-cache_logs\2019-03-06T22_33_03_316Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code2
cagline, FiringBlanks, mikeclagg, C2SO, and beschi-gnanaraj reacted with thumbs up emoji
ricsmania reacted with thumbs down emoji
All reactions
@RUPALAVECINO did you try updating to firebase-admin@^7.0.0?
I ran npm install typescript --save-dev
but still got errors which running: npm install firebase-admin@^7.0.0
made go away.
It could be that package(firebase-admin), or another peer dependency preventing it from installing.
Sure. This library uses syntax introduced in TypeScript 3.4, which allows us to provide better experience to our users by having better autocompletion and stricter compiler (static) checks, so your code breaks less in runtime.
The specific syntax that causes the issue for you is const assertion (as const
), introduced in TypeScript 3.4: microsoft/TypeScript#29435
You need to update your TypeScript compiler to at least this version, by running e.g. npm i --save-dev typescript@latest
.
As a side note, I can recommend automatic your dependency update process by using tools like [Renovate](npm i --save-dev typescript@latest), which take this burden off your shoulders.
ReaperTech, ferdousulhaque, Swapnil-mobiuso, Jbz797, codevon, esoterra, julianmacagno, nyuletony, Rubylago, and andriyor reacted with thumbs up emoji
szymonlisiecki reacted with thumbs down emoji
ferdousulhaque and Swapnil-mobiuso reacted with heart emoji
ferdousulhaque and Swapnil-mobiuso reacted with rocket emoji
All reactions
> tsc.cmd
node_modules/firebase-functions/lib/function-configuration.d.ts:4:64 - error TS1005: ']' expected.
4 export declare const SUPPORTED_REGIONS: readonly ["us-central1", "us-east1", "us-east4", "europe-west1", "europe-west2", "asia-east2", "asia-northeast1"];
node_modules/firebase-functions/lib/function-configuration.d.ts:4:66 - error TS1134: Variable declaration expected.
4 export declare const SUPPORTED_REGIONS: readonly ["us-central1", "us-east1", "us-east4", "europe-west1", "europe-west2", "asia-east2", "asia-northeast1"];
~~~~~~~~~~
node_modules/firebase-functions/lib/function-configuration.d.ts:4:153 - error TS1005: ';' expected.
4 export declare const SUPPORTED_REGIONS: readonly ["us-central1", "us-east1", "us-east4", "europe-west1", "europe-west2", "asia-east2", "asia-northeast1"];
node_modules/firebase-functions/lib/function-configuration.d.ts:16:61 - error TS1005: ']' expected.
16 export declare const VALID_MEMORY_OPTIONS: readonly ["128MB", "256MB", "512MB", "1GB", "2GB"];
node_modules/firebase-functions/lib/function-configuration.d.ts:16:63 - error TS1134: Variable declaration expected.
16 export declare const VALID_MEMORY_OPTIONS: readonly ["128MB", "256MB", "512MB", "1GB", "2GB"];
~~~~~~~
node_modules/firebase-functions/lib/function-configuration.d.ts:16:93 - error TS1005: ';' expected.
16 export declare const VALID_MEMORY_OPTIONS: readonly ["128MB", "256MB", "512MB", "1GB", "2GB"];
Found 6 errors.
@merlinnot I have made sure to upgrade the global tsc too, and also made sure that I was using the global one. Not working. I forced using the local tsc too. None of the approaches worked.
@kkusanagi I will try those versions asap, thanks:
@Spiralis I've found a combination of the most updated versions that appears to work for me:
"dependencies": {
"firebase-admin": "^8.5.0",
"firebase-functions": "^3.0.2"
"devDependencies": {
"tslint": "~5.8.0",
"typescript": "^3.3.1"
@Spiralis These are the most updated versions that appear to work:
"dependencies": {
"firebase-admin": "^8.5.0",
"firebase-functions": "^3.0.2"
"devDependencies": {
"tslint": "~5.8.0",
"typescript": "^3.3.1"
I tried to produce a minimal case to reproduce and it all worked. However, as I moved the functions folder into the same project as my netxjs/react/firestore typescript application (using yarn), the compilation failed.
At the moment I am instead keeping the firebase functions in a separate project. It might be mix of npm and yarn, it might be something different. I don't have the time to investigate more, as I have to do some actual coding too :)
Well. I am not sure anymore. I have had different errors. But, it seems to me that I am not able to set this up as a sub-folder in my main firebase repo. That is, where I host my typescript nextjs firebase project, using yarn. I can set it up as a separate folder and repo it seems, but within that repo, no go. So, I have made a separate repo for it now.
I think I have the latest ts, tslint, firebase-admin,firebase-functions and it doesn't work…
"engines": {
"node": "8"
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "rm -rf lib && tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase experimental:functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
"main": "lib/index.js",
"dependencies": {
"@types/request-promise": "^4.1.41",
"camelcase": "^5.0.0",
"firebase-admin": "8.5.0",
"firebase-functions": "^3.2.0",
"glob": "^7.1.2",
"moment": "^2.22.1",
"request": "^2.80.0",
"request-promise": "^4.1.1"
"devDependencies": {
"tslint": "^5.20.0",
"typescript": "^3.6.3"
"private": true
and I get this…
73 interface IteratorResult<T> { }
~~~~~~~~~~~~~~
node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
~~~~~~~~~~~~~~
'IteratorResult' was also declared here.
node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.
41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
~~~~~~~~~~~~~~
node_modules/@types/node/index.d.ts:73:11
73 interface IteratorResult<T> { }
~~~~~~~~~~~~~~
'IteratorResult' was also declared here.
Found 2 errors.
also…
❯ tsc --version
Version 3.6.3
EDIT:
Sorry, just found this aws/aws-cdk#3839, fixed with npm install @types/node@8
.
sreyseng, drsamdonegan, askilondz, tripflex, iamswain25, and andriyor reacted with thumbs up emoji
tripflex reacted with hooray emoji
All reactions
Running firebase deploy
results in Error: functions predeploy error: Command terminated with non-zero exit code2
FirebaseExtended/firestore-codelab-extended-swift#33
Installing the latest version of typescript globally npm install -g typescript
worked for me.
Also I updated the typescript version in functions/package.json.
This worked for me:
npm install -g typescript (has to be installed globally so yes -g is needed)
Restart Visual Studio (in my case I was using vscode)
npm install typescript --save-dev
did the trick. Thanks!
npm install typescript --save-dev
It works. Thanks.
version occur in "devDependencies": "typescript": "^3.9.7"