Firebase deploy errors starting with non-zero exit code (space in project path)
Firebase deploy errors starting with non-zero exit code (space in project path)
I was having issues with firebase deploy command recently. After firebase deploy command all others were being deployed except firebase (storage, database etc) So I decided to reinstall firebase to fix this situation but after reinstall my problem got bigger. Now none of them are deployed with the following error:
i deploying database, functions
Running command: npm --prefix $RESOURCE_DIR run lint
npm ERR! path C:UsersfarukGoogle DriveAndroidfirebase1$RESOURCE_DIRpackage.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:UsersfarukGoogle DriveAndroidfirebase1$RESOURCE_DIRpackage.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersfarukAppDataRoamingnpm-cache_logs2018-01-24T18_21_34_878Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code4294963238
After a bit research, I saw some topics about this which advice to change
$RESOURCE_DIR to %RESOURCE_DIR%
in windows systems (I am using windows 10 btw). So, I edited my firebase.json file which is in one upper level of my functions folder. like this. (I don't know if this is the right file that I should edit)
"database": {
"rules": "database.rules.json"
},
"functions": {
"predeploy": [
"npm --prefix %RESOURCE_DIR% run lint"
]
}
}
but after this edit, I started to get another error message like this.
i deploying database, functions
Running command: npm --prefix %RESOURCE_DIR% run lint
Usage: npm <command>
where <command> 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 <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
C:Usersfaruk.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@5.6.0 C:Program Filesnodejsnode_modulesnpm
Error: functions predeploy error: Command terminated with non-zero exit code1
Any advice is appreciated. Thanks in advance.
4 Answers
4
The error stems from the fact that you have a space somewhere in the path of your project ("Google Drive"):
C:UsersfarukGoogle DriveAndroidfirebase1$RESOURCE_DIRpackage.json
Unfortunately, this is confusing the npm command line, and it's taking that as two arguments separated by that space.
Normally, I would expect to be able to place quotes around the whole thing to keep the space from being interpreted that way. So I tried this:
"predeploy": [
"npm --prefix "%RESOURCE_DIR%" run lint"
]
And it works for me.
I'll follow up with the Firebase team internally about this issue, as well as the fact that changes need to be made for Windows.
Well, the lint predeploy hooks are new in projects created by CLI version 3.17.0 and later, which is very new. So you're running stuff that you probably hadn't before. Check your other Firebase projects' firebase.json to see what I mean.
– Doug Stevenson
Jan 24 at 20:02
Thank you so much
– Ronel Gonzales
Feb 12 at 4:34
@DougStevenson This is still an issue, did you manage to follow up internally? P.S. I'm on a Mac
– Aodh
Feb 23 at 20:05
i had the same problem in windows so what i did i was copied all the files which were in functions folder and past it to %RESOURCE_DIR% folder and then i run the firebase deploy and it deployed successfully.
you can try that too and i hope this will help you too. if it works for you vote up this answer. so it help others too.
What happens actually is that in Windows, firebase.json contains the following by default:
firebase.json
"predeploy": [
"npm --prefix "$RESOURCE_DIR" run lint"
]
Modify it to:
"predeploy": [
"npm --prefix "%RESOURCE_DIR%" run lint"
]
It worked for me, hope it works for you.
For me, the issue was (I presume) because firebase couldn't find the script.
firebase
{
"hosting": {
"predeploy": "predeploy.sh",
...
}
Running command: predeploy.sh
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn predeploy.sh ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
Error: hosting predeploy error: Command terminated with non-zero exit code1
./
{
"hosting": {
"predeploy": "./predeploy.sh",
...
}
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thank you very much, as i always worked in the same directory i didnt think it will cause the error. Worked like a charm.
– Faruk
Jan 24 at 19:56