我最近遇到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
经过一番研究,我看到了一些关于这个改变建议的话题
$RESOURCE_DIR to %RESOURCE_DIR%
在Windows系统(我使用Windows 10顺便说一句) . 所以,我编辑了firebase.json文件,该文件位于我的函数文件夹的上一级 . 像这样 . (我不知道这是否是我应该编辑的正确文件)
"database": {
"rules": "database.rules.json"
},
"functions": {
"predeploy": [
"npm --prefix %RESOURCE_DIR% run lint"
]
}
}
但在这次编辑之后,我开始收到这样的另一条错误消息 .
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
任何建议表示赞赏 . 提前致谢 .
5 回答
我在Windows中遇到了同样的问题 . 我做的是我复制了 functions 文件夹中的所有文件并将其传递到 %RESOURCE_DIR% 文件夹,然后运行Firebase部署并成功部署 .
在firebase.json中将$ RESOURCE_DIR更改为%RESOURCE_DIR%后,这对我有用
该错误源于您在项目路径中的某个位置(“Google Cloud 端硬盘”):
不幸的是,这使得npm命令行感到困惑,并且它将其视为由该空格分隔的两个参数 .
通常情况下,我希望能够在整个事情周围放置引号以防止空间被解释 . 所以我尝试了这个:
它对我有用 .
我将在内部跟进Firebase团队有关此问题的信息,以及需要对Windows进行更改的事实 .
实际上会发生什么,在Windows中,
firebase.json
默认包含以下内容:将其修改为:
它对我有用,希望它适合你 .
对我来说,问题是(我推测),因为
firebase
找不到脚本 .没用了:
做了工作:(注意./)