我全新安装了 firebase 工具(遵循此 tutorial ),并且我正在尝试上传我的第一个 firebase 函数。我在运行 firebase init 时初始化的 hello-world 示例中遇到了这个问题(在 init 期间唯一设置函数 CLI 功能)
如果我用我的函数文件夹替换 firebase.json
中的 $RESOURCE_DIR
,它就可以工作,但当然这是不好的做法,我想找到一个合适的 $RESOURCE_DIR
替换有效。
PS D:\workspace\firebase-functions> firebase deploy
=== Deploying to 'newagent-5221d'...
i deploying functions
Running command: npm --prefix $RESOURCE_DIR run lint
npm ERR! path D:\workspace\firebase-functions\$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 'D:\workspace\firebase-functions\$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\dtlut\AppData\Roaming\npm-cache\_logs\2018-01-19T15_57_22_990Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code4294963238
最佳答案
尝试在 firebase.json
文件中将 $RESOURCE_DIR 替换为 %RESOURCE_DIR%。
多平台解决方案
如 this post 上所示让我们总结一下您运行的不同平台的配置:
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"
]
关于firebase - 在 npm 上使用 firebase 部署时出错 --prefix $RESOURCE_DIR run lint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48345315/