问题描述
我有全新安装的 firebase 工具(按照此教程)和我正在尝试上传我的第一个 firebase 功能.我在运行 firebase init 时初始化的 hello-world 示例中遇到了这个问题(在初始化期间唯一设置函数 CLI 功能)
I have a fresh install of firebase tools (following this tutorial) and I'm trying to upload my first firebase function. I get this issue with the hello-world example that they initialise when you run firebase init (The only set up the functions CLI feature during the init)
如果我将 firebase.json
中的 $RESOURCE_DIR
替换为我的函数文件夹,它可以工作,但当然这是不好的做法,我想找到一个合适的 $RESOURCE_DIR
替换有效.
If I replace $RESOURCE_DIR
in firebase.json
with my functions folder it works, but of course that Is bad practice and I'd like to find a proper $RESOURCE_DIR
replacement that works.
PS D:workspacefirebase-functions> firebase deploy
=== Deploying to 'newagent-5221d'...
i deploying functions
Running command: npm --prefix $RESOURCE_DIR run lint
npm ERR! path D:workspacefirebase-functions$RESOURCE_DIRpackage.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'D:workspacefirebase-functions$RESOURCE_DIRpackage.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:UsersdtlutAppDataRoaming
pm-cache\_logs2018-01-19T15_57_22_990Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code4294963238
推荐答案
尝试在 firebase.json
文件中将 $RESOURCE_DIR 替换为 %RESOURCE_DIR%.
Try to replace $RESOURCE_DIR with %RESOURCE_DIR% in your firebase.json
file.
多平台解决方案
正如这篇文章上看到的,让我们总结一下配置您运行的不同平台:
As seen on this post let's summarize the configuration for the different platforms you are running on:
Linux
"predeploy": [
"npm --prefix "$RESOURCE_DIR" run lint"
]
PowerShell
"predeploy": [
"npm --prefix $Env:RESOURCE_DIR run lint"
]
Cmd.exe
"predeploy": [
"npm --prefix %RESOURCE_DIR% run lint"
]
这篇关于在 npm --prefix $RESOURCE_DIR run lint 上使用 firebase 部署时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!