Far*_*ruk 21 node.js firebase google-cloud-functions firebase-cli
我最近遇到firebase deploy命令的问题.在firebase部署命令之后,除了firebase(存储,数据库等)之外,所有其他人都被部署了所以我决定重新安装firebase来修复这种情况,但重新安装后我的问题变大了.现在没有部署它们,并出现以下错误:
i deploying database, functions
Running 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
Run Code Online (Sandbox Code Playgroud)
经过一番研究,我看到了一些关于这个改变建议的话题
$RESOURCE_DIR to %RESOURCE_DIR%
Run Code Online (Sandbox Code Playgroud)
在Windows系统(我使用Windows 10顺便说一句).所以,我编辑了firebase.json 文件,该文件位于我的函数文件夹的上一级.像这样.(我不知道这是否是我应该编辑的正确文件)
"database": {
"rules": "database.rules.json"
},
"functions": {
"predeploy": [
"npm --prefix %RESOURCE_DIR% run lint"
]
}
}
Run Code Online (Sandbox Code Playgroud)
但在这次编辑之后,我开始收到这样的另一条错误消息.
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:\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
Run Code Online (Sandbox Code Playgroud)
任何建议表示赞赏.提前致谢.
Dou*_*son 39
该错误源于您在项目路径中的某个位置("Google云端硬盘"):
C:\Users\faruk\Google Drive\Android\firebase\1\$RESOURCE_DIR\package.json
Run Code Online (Sandbox Code Playgroud)
不幸的是,这使得npm命令行感到困惑,并且它将其视为由该空格分隔的两个参数.
通常情况下,我希望能够在整个事情周围放置引号以防止空间被解释.所以我尝试了这个:
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint"
]
Run Code Online (Sandbox Code Playgroud)
它对我有用.
我将在内部跟进Firebase团队有关此问题的信息,以及需要对Windows进行更改的事实.
小智 16
实际上,在Windows中,firebase.json默认情况下包含以下内容:
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
Run Code Online (Sandbox Code Playgroud)
将其修改为:
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint"
]
Run Code Online (Sandbox Code Playgroud)
它对我有用,希望它适合你.
对我来说,以上都不起作用。最初,在新的 firebase-function 安装中,我在non-zero exit code2. 所以我删除了functions目录,重新安装,但在functions目录配置步骤中,我选择对add-lint步骤说“不”。
一旦我选择不包含 lint,我就会收到错误non-zero exit code1。
从那里检查我的 firebase.json 文件并查看预部署脚本。因为此时部署过程失败了,所以我就从这里开始。我的 firebase.json 文件如下所示:
{
"functions": {
"predeploy": [ "npm --prefix \"$RESOURCE_DIR\" run lint" ]
}
}
Run Code Online (Sandbox Code Playgroud)
由于某种原因,我直觉地认为要删除lint预部署脚本中的 。这解决了一切。顺便说一句,我在 MacOS 上..
| 归档时间: |
|
| 查看次数: |
14822 次 |
| 最近记录: |