Home > Blockchain >  Turning on the 'esModuleInterop' flag
Turning on the 'esModuleInterop' flag

Time:05-04

I'm using Firebase Functions for my App. I installed these firebase functions on my PC but I can't use the following command:

Firebase deploy --only functions

I get the following error:

node_modules/google-gax/build/protos/iam_service.d.ts:17:23 - error TS2497: This module 
can only be referenced with ECMAScript imports/exports by turning on the 
'esModuleInterop' flag and referencing its default export.

17 import * as Long from 'long';
                       ~~~~~~

node_modules/google-gax/build/protos/operations.d.ts:17:23 - error TS2497: This module 
can only be referenced with ECMAScript imports/exports by turning on the 
'esModuleInterop' flag and referencing its default export.

17 import * as Long from 'long';
                         ~~~~~~

Found 2 errors in 2 files.

Errors  Files
 1  node_modules/google-gax/build/protos/iam_service.d.ts:17
 1  node_modules/google-gax/build/protos/operations.d.ts:17

Error: functions predeploy error: Command terminated with non-zero exit code2

Does anyone know how to turn on this flag?

CodePudding user response:

just add "skipLibCheck": true to your tsconfig.json as shown below:

"compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2017",
    "skipLibCheck": true
  },
  • Related