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

查看:19
本文介绍了Cloud Functions 在 Windows 上的 lint 期间部署错误:“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:UsersBeatleginformant$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 
'C:UsersBeatleginformant$RESOURCE_DIRpackage.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 环境但没有成功.假设它将在 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

推荐答案

这是 Firebase CLI 3.17.0 到至少 3.17.3 的一个已知问题,但仅限于 Windows.您可以通过在项目根目录编辑 firebase.json 并在 npm 中将 $RESOURCE_DIR 替换为 %RESOURCE_DIR% 在您的计算机上解决此问题你在那里看到的命令.前者是使用环境变量的 unix 语法方式,而后者是 Windows 命令 shell 语法.由于您使用的是 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 创建的项目应解决此问题.

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

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