node.js - 在 %RESOURCE_DIR% 中找不到 Firebase 函数部署问题 : package. json

标签 node.js firebase npm google-cloud-functions firebase-cli

我在部署 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/

相关文章:

Flutter - Firebase Firestore 文档 uid 不存在

Node.js 和 npm 选择 "package"或 "module"哪个单词?

javascript - 如何将基于nodejs的单元测试转换为基于 native 浏览器的单元测试?

node.js - 为什么以及如何将 secret 放入 Node.js 的环境变量中?

Android Firebase 推送通知空白(无文本)

node.js - npm 安装 : when to use --no-bin-links?

node.js - 在 Node.js/NPM 中存档或备份 node_modules 文件夹的最佳方式

node.js - 将 Cloud Functions for Firebase 与 Braintree 集成

jquery - 通过Ajax Jquery将JsonMessage添加到RabbitMQ

ios - 使用 swift 添加多个文本字段到 firebase