Firebase部署错误从非零退出代码(项目路径中的空格)开始
我最近在使用Firebase deploy命令时遇到问题。在执行firebase
deploy命令之后,除了firebase(存储,数据库等)以外,其他所有其他部署也都已部署,因此我决定重新安装firebase来解决这种情况,但是在重新安装后,我的问题变得更大了。现在,没有一个部署以下错误:
i deploying database, functionsRunning command: npm --prefix $RESOURCE_DIR run lint
npm ERR! path C:\Users\faruk\Google Drive\Android\firebase\1\$RESOURCE_DIR\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\faruk\Google Drive\Android\firebase\1\$RESOURCE_DIR\package.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:\Users\faruk\AppData\Roaming\npm-cache\_logs\2018-01-24T18_21_34_878Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code4294963238
经过一些研究,我看到了一些与此相关的主题,这些建议需要更改
$RESOURCE_DIR to %RESOURCE_DIR%在Windows系统中(我正在使用Windows 10 BTW)。因此,我编辑了 位于我的functions文件夹上一层的 firebase.json
文件。像这样。(我不知道这是否是我应该编辑的正确文件)
  "database": {    "rules": "database.rules.json"
  },
  "functions": {
    "predeploy": [
      "npm --prefix %RESOURCE_DIR% run lint"
    ]
  }
}
但是在进行此编辑后,我开始收到另一条错误消息,如下所示。
i  deploying database, functionsRunning 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:\Users\faruk\.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 Files\nodejs\node_modules\npm
Error: functions predeploy error: Command terminated with non-zero exit code1
任何建议表示赞赏。提前致谢。
回答:
该错误源于您的项目路径(“ Google云端硬盘”)中的某个地方存在以下事实:
C:\Users\faruk\Google Drive\Android\firebase\1\$RESOURCE_DIR\package.json不幸的是,这使npm命令行令人困惑,并且将其作为两个参数分隔开来。
通常,我希望能够在整个内容周围加上引号,以防止以这种方式解释空间。所以我尝试了这个:
"predeploy": [  "npm --prefix \"%RESOURCE_DIR%\" run lint"
]
它对我有用。
我将在内部与Firebase团队联系,以解决此问题,以及需要为Windows进行更改的事实。
以上是 Firebase部署错误从非零退出代码(项目路径中的空格)开始 的全部内容, 来源链接: utcz.com/qa/397425.html
