当我想通过使testMatch
来部署网站时看到此错误
firebase deploy
我可以将=== Deploying to 'project'...
i deploying database, functions, hosting
Running command: npm --prefix "%RESOURCE_DIR%" run lint
npm ERR! path /Users/work/Desktop/project/project_2017/project-frontend/%RESOURCE_DIR%/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/work/Desktop/project/project_2017/project-frontend/%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! /Users/work/.npm/_logs/2018-07-11T21_15_01_202Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code254
predeplay
中的参数firebase.json
更改为" npm --prefix \"$RESOURCE_DIR\" run lint"
答案 0 :(得分:1)
发生的事情可能是您项目中的其他人更改了项目firebase.json
,该项目可在Linux和Mac上运行:
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
],
"source": "functions"
}
}
为此,它在Windows上适用:
{
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint",
"npm --prefix \"%RESOURCE_DIR%\" run build"
],
"source": "functions"
}
}
使用一些advice found here on Stack Overflow。进行此更改的原因是因为在Shell命令中使用环境变量的方式不同。
两个人共享该文件并不是一个好方法,因为你们每个人都有不同的需求。你们其中之一将不得不同意不签入对此文件的更改,否则你们俩将不得不反复撤消彼此的更改。
答案 1 :(得分:0)
应该是:
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]