Trying to deploy a cloud function to my firebase under an existing project. Help me fix or find the error?

117 Views Asked by At
C:\Users\alpha\cmj_flutter_app>firebase deploy

=== Deploying to 'cognitive-matters-journa-11c6a'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint C:\Users\alpha\functions
> eslint "src/**/*"

Running command: npm --prefix "$RESOURCE_DIR" run build

> functions@ build C:\Users\alpha\functions
> tsc

src/index.ts:1:1 - error TS6133: 'functions' is declared but its value is never read.
 

import * as functions from 'firebase-functions';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error.

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\alpha\AppData\Roaming\npm-cache\_logs\2020-11-20T04_21_16_357Z-debug.log

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

There are 1 best solutions below

4
Doug Stevenson On

The error message is telling you that there's a problem with your code. Please read it carefully:

src/index.ts:1:1 - error TS6133: 'functions' is declared but its value is never read.
 

import * as functions from 'firebase-functions';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You are declaring a variable called functions on the first line, but you never used it.

I can only imagine that you didn't edit and save the default file you were given when you initialized the project.