Firebase-tools: Functions Predeploy Error

Created on 6 Feb 2018  路  9Comments  路  Source: firebase/firebase-tools

Version info

3.17.4

Steps to reproduce

Initialize new firebase project.
Select Realtime Database, Hosting, and Functions.
firebase deploy

Expected behavior

"Blank"/Initialized firebase project should get deployed

Actual behavior

[2018-02-06T01:13:34.913Z] ----------------------------------------------------------------------
[2018-02-06T01:13:34.916Z] Command: /usr/local/Cellar/node/8.9.0/bin/node /usr/local/bin/firebase deploy --debug
[2018-02-06T01:13:34.917Z] CLI Version: 3.17.4
[2018-02-06T01:13:34.917Z] Platform: darwin
[2018-02-06T01:13:34.917Z] Node Version: v8.9.0
[2018-02-06T01:13:34.918Z] Time: Mon Feb 05 2018 17:13:34 GMT-0800 (PST)
[2018-02-06T01:13:34.918Z] ----------------------------------------------------------------------

[2018-02-06T01:13:34.928Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2018-02-06T01:13:34.928Z] > authorizing via signed-in user
[2018-02-06T01:13:34.930Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/kg-volunteer

Mon Feb 05 2018 17:13:34 GMT-0800 (PST)
[2018-02-06T01:13:35.542Z] <<< HTTP RESPONSE 200 server=nginx, date=Tue, 06 Feb 2018 01:13:35 GMT, content-type=application/json; charset=utf-8, content-length=111, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-02-06T01:13:35.543Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/kg-volunteer/tokens

Mon Feb 05 2018 17:13:35 GMT-0800 (PST)
[2018-02-06T01:13:35.915Z] <<< HTTP RESPONSE 200 server=nginx, date=Tue, 06 Feb 2018 01:13:35 GMT, content-type=application/json; charset=utf-8, content-length=260, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store

=== Deploying to 'kg-volunteer'...

i deploying database, functions, hosting
Running command: npm --prefix $RESOURCE_DIR run lint

Usage: npm

where is one of:
access, adduser, bin, bugs, c, cache, completion, config,
ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
explore, get, help, help-search, i, init, install,
install-test, it, link, list, ln, login, logout, ls,
outdated, owner, pack, ping, prefix, profile, prune,
publish, rb, rebuild, repo, restart, root, run, run-script,
s, se, search, set, shrinkwrap, star, stars, start, stop, t,
team, test, token, tst, un, uninstall, unpublish, unstar,
up, update, v, version, view, whoami

npm -h quick help on
npm -l display full usage info
npm help search for help on
npm help npm involved overview

Specify configs in the ini-formatted file:
/Users/dawsond3/.npmrc
or on the command line via: npm --key value
Config info can be viewed via: npm help config

[email protected] /usr/local/lib/node_modules/npm

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

Most helpful comment

I'm not sure what effects this might have but by completely removing the predeploy section in the firebase.json file everything deployed normally.

All 9 comments

I'm not sure what effects this might have but by completely removing the predeploy section in the firebase.json file everything deployed normally.

@d3ddd Could you run firebase deploy --only functions --debug and paste the output here (with the predeploy scripts)?

[2018-02-08T20:55:08.667Z] ----------------------------------------------------------------------
[2018-02-08T20:55:08.670Z] Command: /usr/local/bin/node /usr/local/bin/firebase deploy --only functions --debug
[2018-02-08T20:55:08.671Z] CLI Version: 3.17.4
[2018-02-08T20:55:08.671Z] Platform: darwin
[2018-02-08T20:55:08.671Z] Node Version: v8.9.4
[2018-02-08T20:55:08.672Z] Time: Thu Feb 08 2018 12:55:08 GMT-0800 (PST)
[2018-02-08T20:55:08.672Z] ----------------------------------------------------------------------

[2018-02-08T20:55:08.682Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2018-02-08T20:55:08.684Z] > authorizing via signed-in user
[2018-02-08T20:55:08.686Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/kg-volunteer

Thu Feb 08 2018 12:55:08 GMT-0800 (PST)
[2018-02-08T20:55:09.127Z] <<< HTTP RESPONSE 200 server=nginx, date=Thu, 08 Feb 2018 20:55:09 GMT, content-type=application/json; charset=utf-8, content-length=111, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-02-08T20:55:09.128Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/kg-volunteer/tokens

Thu Feb 08 2018 12:55:09 GMT-0800 (PST)
[2018-02-08T20:55:09.526Z] <<< HTTP RESPONSE 200 server=nginx, date=Thu, 08 Feb 2018 20:55:09 GMT, content-type=application/json; charset=utf-8, content-length=260, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store

=== Deploying to 'kg-volunteer'...

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

Usage: npm

where is one of:
access, adduser, bin, bugs, c, cache, completion, config,
ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
explore, get, help, help-search, i, init, install,
install-test, it, link, list, ln, login, logout, ls,
outdated, owner, pack, ping, prefix, profile, prune,
publish, rb, rebuild, repo, restart, root, run, run-script,
s, se, search, set, shrinkwrap, star, stars, start, stop, t,
team, test, token, tst, un, uninstall, unpublish, unstar,
up, update, v, version, view, whoami

npm -h quick help on
npm -l display full usage info
npm help search for help on
npm help npm involved overview

Specify configs in the ini-formatted file:
/Users/dawsond3/.npmrc
or on the command line via: npm --key value
Config info can be viewed via: npm help config

[email protected] /usr/local/lib/node_modules/npm

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

Does npm work if you run it by itself? Say npm -v?

Yep it works (v5.6.0)

The output tells you exactly the command that's running and having trouble: npm --prefix $RESOURCE_DIR run lint.

Can you run that (may want to export RESOURCE_DIR=functions first), see if it has the same error, and maybe play around with it a bit to see if there's a variation that does work?

FWIW my best guess is that $RESOURCE_DIR is somehow not set, which is causing the command to effectively be npm --prefix run lint and it's erroring because npm lint isn't a command.

Error: spawn npm --prefix .\functions\ run lint ENOENT
at notFoundError (C:\Users\MAULIK BHANDERI\AppData\Roaming\npmnode_modules\firebase-toolsnode_modules\cross-envnode_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\MAULIK BHANDERI\AppData\Roaming\npmnode_modules\firebase-toolsnode_modules\cross-envnode_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\MAULIK BHANDERI\AppData\Roaming\npmnode_modules\firebase-toolsnode_modules\cross-envnode_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
Emitted 'error' event at:
at ChildProcess.cp.emit (C:\Users\MAULIK BHANDERI\AppData\Roaming\npmnode_modules\firebase-toolsnode_modules\cross-envnode_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)

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

how I solve it please help me

@mauikB please open a new issue with the appropriate information. Thanks.

Was this page helpful?
0 / 5 - 0 ratings