首页 文章

Cloud 功能未从命令行部署

提问于
浏览
0

我在部署我的 Cloud 功能时遇到了麻烦 . 我移动到保存我的函数的android项目的根目录并使用 firebase deploy 命令,我得到这个输出:

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

错误:函数预部署错误:命令以非零退出代码1终止

如何开始解决此错误?

1 回答

  • 2

    项目路径中的空间位于“计算机科学”文件夹中:

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

    这搞乱了运行CLI的lint命令行的解析 . 你有两个选择:

    • 使用其中没有空格的路径

    • 在predeploy lint命令中引用$ RESOURCE_DIR变量 .

    我建议#1,因为在unix中传统文件名中没有空格,但是如果你想做#2,请编辑你的firebase.json并查找这样的行:

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

    然后在变量周围放置转义引号:

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

    这将阻止运行npm的shell将路径中的空间解释为命令行参数分隔符 .

相关问题