在Windows上的lint期间,Cloud Functions会部署错误:"enoent ENOENT:没有这样的文件或目录"; [英] Cloud Functions deploy error during lint on Windows: "enoent ENOENT: no such file or directory"

查看:56
本文介绍了在Windows上的lint期间,Cloud Functions会部署错误:"enoent ENOENT:没有这样的文件或目录";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遵循 firebase函数入门指南,并一次获得看似简单的错误尝试通过以下方式进行部署:

Following the firebase function getting started guide and getting a seemingly simple error once trying to deploy with:

firebase deploy --only functions

i  deploying functions
Running command: npm --prefix $RESOURCE_DIR run lint
npm ERR! path C:\Users\Beat\leginformant\$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 
'C:\Users\Beat\leginformant\$RESOURCE_DIR\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

package.json文件确实存在,正如本教程在我的project/functions/package.json中显示的一样. 尝试更改或打印RESOURCE_DIR env失败.假设它将在NPM Shell环境内进行作用.

The package.json file does exist just as the tutorial shows in my project/functions/package.json. Have tried changing or printing out the RESOURCE_DIR env with no success. Assuming it would be scoped inside of the NPM shell environment.

npm版本:5.6.0

npm version: 5.6.0

节点版本:8.9.0

node version: 8.9.0

推荐答案

这是Firebase CLI 3.17.0(至少通过3.17.3)的一个已知问题,但仅在Windows上如此.您可以通过在项目根目录中编辑firebase.json并在您在其中看到的npm命令中将$RESOURCE_DIR替换为%RESOURCE_DIR%的方式,在计算机上修复此问题.前者是使用环境变量的unix语法方式,而后者是Windows命令外壳语法.由于您使用的是Windows,因此需要使用Windows语法.

This is a known problem with the Firebase CLI 3.17.0 through at least 3.17.3, but only on Windows. You can fix this on your machine by editing firebase.json at the root of your project and replacing $RESOURCE_DIR with %RESOURCE_DIR% in the npm commands you see there. The former is the unix syntax way to use an environment variable, whereas the latter is the Windows command shell syntax. Since you're using Windows, you need to use the Windows syntax.

该团队正在研究避免必须对您使用的配置文件进行更改的方法,因为跨平台工作的团队不断来回更改同一文件并不十分方便.

The team is looking into ways to prevent having to make changes to the config files you use, as it's not really convenient for teams that works across platform to keep changing the same file back and forth.

使用CLI版本3.17.5创建的项目应解决此问题.

这篇关于在Windows上的lint期间,Cloud Functions会部署错误:"enoent ENOENT:没有这样的文件或目录";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆