Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Vijay1126 opened this issue Apr 29, 2020 · 2 comments
Closed

Comments

@Vijay1126
Copy link

Vijay1126 commented Apr 29, 2020

Hey everyone, I just started with the first tutorial "Getting Started with Cloud Functions for Firebase using TypeScript - Firecasts" on YouTube.
While trying to deploy the code, I get the error shown below.

Device: Macbook Pro
Node version: v12.16.3
Typescript version: version 3.8.3

Expected behavior

Deploy successfully

Actual behavior

vijayraja@Vijays-MBP functions % firebase deploy

=== Deploying to 'pleasework-770e8'...

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

> functions@ lint /Users/vijayraja/newfire/functions
> tslint --project tsconfig.json

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

> functions@ build /Users/vijayraja/newfire/functions
> tsc

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

1 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!     /Users/vijayraja/.npm/_logs/2020-04-29T06_39_58_655Z-debug.log

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

I have attached the all the screenshots below:

Error:
image

My index.ts file :
image

Firebase.json file:
image

tsconfig.json file:
image

package.json file:
image

I'm aware there are other threads with the same issue, but I tried all of them, none of them worked.
What I tried doing:

  1. Place the "typeRoots" key inside "compilerOptions" (Functions only deploy erroring, referencing parent application node_modules folder firebase-tools#749)
  2. npm run build and restart VSCode (Functions only deploy erroring, referencing parent application node_modules folder firebase-tools#749)

Please help.

@jhuleatt
Copy link
Collaborator

@Vijay1126 did you save your index.ts file before trying to deploy? That's a linter error that's saying the functions variable defined in line 1 of index.ts isn't used. You use it in line 6, so I think it's just a matter of saving that file and trying again 😄

@Vijay1126
Copy link
Author

THANK YOU!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants