skip to Main Content

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


  1. Chosen as BEST ANSWER

    Solved by choosing this in my package.json

    "dependencies": {
        "firebase-admin": "^8.5.0",
        "firebase-functions": "^3.0.2"
      },
      "devDependencies": {
        "@typescript-eslint/eslint-plugin": "^3.9.1",
        "@typescript-eslint/parser": "^3.8.0",
        "eslint": "^7.6.0",
        "eslint-config-google": "^0.14.0",
        "eslint-plugin-import": "^2.22.0",
        "firebase-functions-test": "^0.2.0",
        "tslint": "~5.8.0",
        "typescript": "4.1.2"
      },
      "resolutions": {
        "@types/express-serve-static-core": "4.17.20",
        "@types/express": "4.17.2"
      },
    

    Then running commande : rm -r node_modules

    Then after installing everything using commande : npm i


  2. 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 running rm -r node_modules in your functions directory before running npm 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search