首页 文章

Firebase功能部署问题:%RESOURCE_DIR%中找不到package.json

提问于
浏览
4

我有部署Firebase Cloud 功能的问题 .

Steps to reproduce

  • firebase init

  • 仅选择功能

  • 选择Firebase项目

  • 选择Javascript

  • 使用ESLint

  • 现在用npm安装依赖项

  • 运行firebase部署

Expected Result

期望使用firebase-tools来部署 Cloud 功能 .

Actual Result

收到以下错误消息:

λ 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

请帮忙!

谢谢 .

4 回答

  • 0

    我有同样的问题,只需从firebase.json文件中删除predeploy,它将正常工作

  • 15

    看起来您要么使用旧版本的Firebase CLI,要么使用旧版本初始化的项目 . 最干净的事情是升级CLI:

    npm install -g firebase-tools
    

    并使用 firebase init 从头开始创建一个全新的项目 . 然后,使用旧项目中的代码重新构建新项目 .

  • 1

    1. 在firebase.json文件中

    尝试将 $RESOURCE_DIR 替换为 %RESOURCE_DIR%

    "npm --prefix $RESOURCE_DIR run lint" to "npm --prefix %RESOURCE_DIR% run lint"

    (上面刚刚解决了)

    2. npm install -g git://github.com/firebase/firebase-tools#master

    请在你的项目文件夹中再次尝试此安装它应该解决问题

  • 0

    尝试在“firebase.json”文件中将字符串“$ RESOURCE_DIR”替换为“%RESOURCE_DIR%” .

    现在再次运行deploy命令 . 它对我有用 .

    编辑:此修复程序适用于Windows,现在该项目将不是跨平台的,如此答案中所述:similar question

相关问题