我在部署 Firebase Cloud Functions 时遇到问题。
重现步骤
- 火力点初始化
- 仅选择函数
- 选择 Firebase 项目
- 选择Javascript
- 使用 ESLint
- 现在使用 npm 安装依赖项
- 运行 firebase 部署
预期结果
期待 firebase-tools 部署云功能。
实际结果
收到以下错误消息:
λ firebase deploy
=== Deploying to '<projects>'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
npm ERR! path ...path\firebaseFunction\%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 '...path\firebaseFunction\%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! ...path\AppData\Roaming\npm-cache\_logs\2018-06-17T10_02_45_577Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code4294963238
我已经尝试用谷歌搜索并按照以下链接中的解决方案进行操作,但它对我不起作用: https://github.com/firebase/firebase-tools/issues/610
求助!
谢谢。
最佳答案
尝试将“firebase.json”文件中的字符串 "$RESOURCE_DIR"
替换为 "%RESOURCE_DIR%"
。
现在再次运行部署命令。它对我有用。
说明:此修复适用于 Windows,因为 %RESOURCE_DIR%
将仅被 Windows 命令行解释器识别为环境变量。作为最终结果,该项目不再是跨平台的,如本 similar question 的回答中所述。 .
关于node.js - 在 %RESOURCE_DIR% 中找不到 Firebase 函数部署问题 : package. json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50895669/