firebase - 在 npm 上使用 firebase 部署时出错 --prefix $RESOURCE_DIR run lint

标签 firebase npm google-cloud-functions

我全新安装了 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/

相关文章:

node.js - Elastic Beanstalk - 无法运行 npm install

python - 使用 Google 云函数写入 Google 云 Spanner 时出错

ios - 在Firebase iOS中链接oAuth提供程序

javascript - Firebase 函数 .onWrite 不起作用?

node.js - 运行 'react' 时无法解析 "npm run"

javascript - 是否可以从firebase云函数node.js更新firestore中的map类型字段?

node.js - Firebase - TypeError : admin. auth(...).createUserWithEmailAndPassword 不是函数

firebase - 使用 angularfire2 在 firebase 数据库中获取时间

firebase - Firebase Crashlytics 控制台中缺少崩溃的堆栈跟踪

node.js - create-react-app 命令中止安装为什么?