When i try to deploy my function i get a lot of error. This is a brand new flutter install and firebase init with Typescript.
Error :
node_modules/@types/express-serve-static-core/index.d.ts:99:68 - error TS1110: Type expected.
99 type RemoveTail<S extends string, Tail extends string> = S extends `${infer P}${Tail}` ? P : S;
~~~
node_modules/@types/express-serve-static-core/index.d.ts:99:77 - error TS1005: '}' expected.
99 type RemoveTail<S extends string, Tail extends string> = S extends `${infer P}${Tail}` ? P : S;
~
node_modules/@types/express-serve-static-core/index.d.ts:99:78 - error TS1128: Declaration or statement expected.
99 type RemoveTail<S extends string, Tail extends string> = S extends `${infer P}${Tail}` ? P : S;
~
node_modules/@types/express-serve-static-core/index.d.ts:99:80 - error TS1005: ';' expected.
99 type RemoveTail<S extends string, Tail extends string> = S extends `${infer P}${Tail}` ? P : S;
~
node_modules/@types/express-serve-static-core/index.d.ts:101:33 - error TS1005: ';' expected.
~
Found 127 errors.
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.
here is my index.ts
import * as functions from "firebase-functions";
// Start writing Firebase Functions
// https://firebase.google.com/docs/functions/typescript
export const helloWorld = functions.https.onRequest((request, response) => {
functions.logger.info("Hello logs!", {structuredData: true});
response.send("Hello from Firebase!");
});
I tried many solution now and none of them are working, the export i try to do is the demo one so there should not be any error in. I upgraded flutter and the firebase cli on my mac.
2
Answers
Solved by choosing this in my package.json
Then running commande : rm -r node_modules
Then after installing everything using commande : npm i
If you are in the default configuration of the base project, a pretty opinionated style is enforced by eslint. Simply running
npx eslint --ext .js,.ts . --fix
in your functions directory will apply this style to your index.ts, thus avoiding issue during pre-deploy script.If after that the issue stay the same (same error when running
firebase deploy
in the function folder), reinstalling the modules could also do the trick as they seems to cause issue. (You could do that by runningrm -r node_modules
in your functions directory before runningnpm i
to install them again.)Finally, you seems to be somewhat confused between Firebase and Flutter in your question, maybe explaining us how Flutter is related to your project could help us providing better advices.