I am getting the following error when executing the command firebase deploy --only function
in my Ionic 3 project. This solution is not working for me.
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build /Users/myuser/Project/functions
> tsc
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"];
~
When I look into file node_modules/firebase-functions/lib/function-configuration.d.ts, it shows the syntax errors.
Version details:
"angularfire2": "^5.2.1",
"firebase": "^6.3.1",
"firebase-admin": "^8.2.0",
"firebase-functions": "3.2.0",
"typescript": "^3.5.3"
npm install -g [email protected] worked for me. I assume higher versions would work as well. It is important to update the global typescript version as my local typescript version update didn't work
Judging from the github issue that you linked and the error message itself, the error seems to be due to the new readonly tuples feature. It was introduced in [email protected]
so, in theory, any typescript version higher than that should work.
In fact, [email protected]
uses [email protected]
so I recommend you use the same or higher.
That being said, I see that you have already used [email protected]
but the error still popped up.
Version details:
"angularfire2": "^5.2.1", "firebase": "^6.3.1", "firebase-admin": "^8.2.0", "firebase-functions": "3.2.0", "typescript": "^3.5.3"
It may be because of a different (older) typescript version being used by some other package internally. Please check your package-lock.json (or yarn.lock) to confirm.
If that's not the case, then my next best guess is that ionic-app-scripts
is using older typescript internally.
Check if any space got added into starting of this file. I had the same issue and after removing the space in the top of the file it was working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With