error TS1005: ';' expected on tsc
I'me getting the following error when trying to run npm run build:
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.
Could you try to update TypeScript first?
Hi @agordeev thanks for filing - can you try @merlinnot 's suggestion and change your package.json typescript declataion to this:"typescript": "^3.1.3?
Can confirm bumping typescript to 3.1.3 fixed for me (was on 2.8.3)
npm install typescript --save-dev did the trick. Thanks!
Awesome, thanks everyone! Glad your issue was resolved @agordeev :)
I upgraded typescript to 3.3.1 which solved this issue.
Seeing as caused issues for a few people, we have now added the mention of TypeScript update into the release notes for v2.2.0. Thanks again everyone :)
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
@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.
When working on webpack changing "typescript": "~3.2.2" on "typescript": "^3.3.1" and hitting 'npm install' afterwards made the job.
Sorry but there's no clear answer for me, can anyone put something to clearify it please?
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: https://github.com/Microsoft/TypeScript/pull/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.
Sorry but it doesnt work still, i did it before
Please provide a minimal repro so I can reproduce it and help. Otherwise it's impossible.
Sorry i tried everything but doesnt work.... cannot put typescript last version, its incompatible with angular compiler
Please need help to fix it, its very annoying....
Angular requires TypeScript compiler from range 3.4, so that should be perfectly fine:
https://github.com/angular/angular/blob/c7542a1d09b27b027a0367a1f3732a908cdd617a/package.json#L111
Hi @manel00,
The newer TypeScript versions (above 3.3) don't work with Angular's 7 compiler (at least 7.2.15). What means that for upgrading to TypeScript 3.4 you need to have your project in Angular 8 most probably, i.e. there is no compatibility with previous versions for the compilation. I can confirm you that it does works, I upgraded Angular to 8.1.1 and have the following Firebase dependencies:
"firebase": "^6.3.1",
"firebase-admin": "^8.2.0",
"firebase-functions": "^3.0.2",
TypeScrpt version: 3.4.2.
I still have the issue with the following versions. "firebase": "^6.3.1", "firebase-admin": "^8.2.0", "firebase-functions": "3.2.0", "angularfire2": "^5.2.1"