0

I'm having trouble deploying my cloud functions. I move to the root directory of the android project that holds my functions and use the firebase deploy command, I get this output:

Last login: Mon Feb 26 23:36:02 on ttys000
joels-MacBook-Pro:~ joeljohnson$ cd /Users/joeljohnson/Documents/Computer\ Science/Android/GradleFinalProject 
joels-MacBook-Pro:GradleFinalProject joeljohnson$ firebase deploy

=== Deploying to 'gradlefinalproject-42f02'...

i  deploying 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:
    /Users/joeljohnson/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@5.6.0 /Users/joeljohnson/.nvm/versions/node/v9.4.0/lib/node_modules/npm

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

How can I begin to troubleshoot this error?

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56

1 Answers1

3

You have a space in the path of your project in the folder "Computer Science":

/Users/joeljohnson/Documents/Computer Science/Android/GradleFinalProject

This is messing up the parsing of the lint command line that the CLI is running. You have two choices:

  1. Use a path that doesn't have a space in it
  2. Quote the $RESOURCE_DIR variable in the predeploy lint command.

I suggest #1, since it's not conventional in unix to have spaces in filenames, but if you want to do #2, edit your firebase.json and look for lines like this:

  "npm --prefix $RESOURCE_DIR run lint",
  "npm --prefix $RESOURCE_DIR run build"

Then put escaped quotes around the variable:

  "npm --prefix \"$RESOURCE_DIR\" run lint",
  "npm --prefix \"$RESOURCE_DIR\" run build"

This will prevent the shell that runs npm from interpreting the space in your path as a command line argument separator.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • I read a post that if you use a "\" after the first word then a space the program treats the file path as if the space isn't there. https://askubuntu.com/a/530581 is this not true? I switch the file path and see what happens. Just out of curiosity, can the deployed be in a folder that is not in the root directory of the android project I'm working on? – Joel Robinson-Johnson Feb 27 '18 at 14:04
  • $RESOURCE_DIR doesn't work like that. It doesn't care what you typed on the command line - it is the actual file path on the filesystem. – Doug Stevenson Feb 27 '18 at 16:23
  • got it, I created another file path to deploy the functions from, that seemed to worked... – Joel Robinson-Johnson Feb 27 '18 at 16:25