在firebase.com/docs上完成所有必要步骤并将我的应用程序升级到更新版本后,我仍然无法运行部署它firebase-tools.
$ firebase部署MY_APP_NAME
给出以下堆栈:
/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/Users/myusername/.config/configstore/update-notifier-firebase-tools.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:634:18)
at Object.fs.readFileSync (fs.js:502:33)
at Object.create.all.get (/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:27:44)
at new UpdateNotifier (/usr/local/lib/node_modules/firebase-tools/node_modules/update-notifier/index.js:34:17)
at module.exports (/usr/local/lib/node_modules/firebase-tools/node_modules/update-notifier/index.js:123:23)
at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/bin/firebase:5:48)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
Run Code Online (Sandbox Code Playgroud)
阅读本文无法部署到firebase.获取ENOENT错误我尝试应用sudo,这有点帮助 - 以及:$ sudo firebase deploy
在3-5秒的明显停顿后导致
Error: Invalid Firebase specified.
Having trouble? Try firebase deploy --help
Run Code Online (Sandbox Code Playgroud)
无论如何:$ sudo …
Firebase deploy当我运行它时,命令总是卡住.
这是详细信息:
$ firebase deploy --token "SOMETOKEN" --debug
----------------------------------------------------------------------
Command: /usr/local/bin/node /usr/local/bin/firebase deploy --token SOMETOKEN --debug
CLI Version: 3.0.0
Platform: darwin
Node Version: v5.0.0
Time: Tue May 24 2016 14:25:31 GMT+0800 (CST)
----------------------------------------------------------------------
> command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
> refreshing access token with scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
>>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token refresh_token=SOMETOKEN, client_id=XXXXXX-XXXXXX.apps.googleusercontent.com, client_secret=XXXXXX, grant_type=refresh_token, scope=email openid https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase
<<< HTTP RESPONSE 200 cache-control=no-cache, no-store, max-age=0, must-revalidate, pragma=no-cache, expires=Mon, 01 Jan 1990 00:00:00 GMT, date=Tue, 24 May 2016 06:25:33 …Run Code Online (Sandbox Code Playgroud) 将deploy命令运行到站点只会使终端闪烁,就像它在一些繁重的操作中卡住一样.
什么都不会发生.我实际上并没有尝试使用--debug旗帜.
首先想到的是我是公司代理的幕后黑手.所以我设置了一个"纯粹"的连接,它仍然没有连接.那么问题是什么?
database deployment firebase firebase-hosting firebase-tools
在我工作的公司中,我们为其他公司提供了一个解决方案,我们希望每个公司都有一个该解决方案的单独实例,这包括一个单独的数据库实例,数据库是Firebase,这种选择创建一个新的单独实例根据我们工作所在国家/地区的数据隐私法,这是必需的。
我正在编写一个脚本,当新客户端注册触发时,它会开始创建新的解决方案实例,包括创建新Firebase项目,我正在使用firebase-tools CLI和gcloud CLI。
项目创建正确,并且管理员帐户已创建,唯一剩下的就是允许管理员能够登录新项目Firebase。这通常是Firebase web console通过启用登录提供程序(Email&Password在我的例子中是登录提供程序)手动完成的。这部分过程不是自动化的,因为我找不到应该传递给项目Firebase-tools或gcloud ClI在项目中启用登录提供程序的命令Firebase。
您可以传递什么命令来Firebase tools更改gcloud CLIfirebase 项目配置以启用登录提供程序?在这种情况下使用 登录Email&Passsword..或者有没有办法使用Google client libraries?
当。。。的时候firebase emulator:start在我的 vscode powershell 终端中运行时,一些 java.exe 窗口会弹出。一切都很好。
当我使用 ctrl+c 命令关闭 firebase 模拟器时,终端中的日志表明一切都应该正常关闭。这是之后的日志^C:
i emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i Automatically exporting data using --export-on-exit "./data" please wait for the export to finish...
Terminate batch job (Y/N)? i Found running emulator hub for project une-petite-partie at http://localhost:4400
i Deleting directory C:\Users\schar\Documents\Programming\Projects\Card …Run Code Online (Sandbox Code Playgroud) 我正在使用 firebase 模拟器来运行测试,并且收到了有关使用缓存系统进行优化的警告。
我怎样才能做到这一点?
看起来您正在 CI 环境中运行。您可以通过缓存 /home/runner/.cache/firebase/emulators 目录来避免重复下载 Firestore 模拟器。
尽管已使用以下命令在本地初始化了身份验证模拟器,但我的应用程序仍然希望使用生产 firebase-auth 实例来验证用户:
firebase init emulators
Run Code Online (Sandbox Code Playgroud)
这是我的 React 应用程序中的身份验证逻辑:
const handleLogin = () =>
authentication.signInWithEmailAndPassword("emulator@test.com", "emulator");
Run Code Online (Sandbox Code Playgroud)
触发handleLogin后,我收到错误“auth/user-not-found”,因为 firebase 正在查询生产身份验证实例。
我正在尝试在新的 Firebase 云存储模拟器中创建额外的存储桶。我在 EmulatorUI 中没有看到任何选项,也没有在网上找到任何资源。这可能吗?
我正在尝试使用 Firebase 客户端 sdk 编写一些自动化测试。这些测试应该使用 Firebase Auth 模拟器。为了避免搞乱生产数据,我使用带有演示项目 ID 的模拟器(如文档中所述)。
我使用以下命令启动模拟器:
firebase emulators:start --project demo-test --only functions,firestore,storage,auth
Run Code Online (Sandbox Code Playgroud)
然后在我的测试中,我使用以下命令初始化应用程序:
import { initializeApp } from 'firebase/app'
import { getAuth, connectAuthEmulator } from 'firebase/auth'
const app = initializeApp({ projectId: 'demo-test' })
const auth = getAuth(app)
connectAuthEmulator(auth, 'http://localhost:9099')
Run Code Online (Sandbox Code Playgroud)
当测试初始化时,我收到此错误:
FirebaseError: Firebase: Error (auth/invalid-api-key).
> 45 | const auth = getAuth(app)
| ^
Run Code Online (Sandbox Code Playgroud)
注意:此问题仅在身份验证时发生。我可以成功连接到 Firestore 等其他模拟器。
看来,不管文档怎么说,我实际上无法将客户端 SDK 连接到演示项目并使用 auth 模拟器。每次我尝试时,都会抛出此错误。
有人知道如何设置演示项目模拟器并将客户端 SDK 连接到身份验证模拟器吗?
firebase --version-->11.1.0
node -v-->v16.15.1
npm -v-->8.11.0
平台:
Pop!_OS 22.04 LTS 64 位
1)。跑步firebase init functions
2)。选择Use an existing project并选择我的项目。
3)。选择Javascript语言。
4). 输入N并按 Enter 键不使用 eslint。
5)。键入Y并按 Enter 键以安装依赖项。
6). 运行firebase emulators:start或firebase emulators:start --only functions
7). 打开functions/index.js并取消注释 helloWorld 示例,然后保存。
我希望函数模拟器能够检测 javascript 代码的更改并自动应用这些更改,而无需重新启动模拟器(手动)。
没有什么变化。我必须重新启动模拟器才能使用 helloWorld 函数。或者,如果该函数在模拟器启动时就在那里,我必须重新启动它才能看到对函数本身所做的更改。如果我在运行 firestore 模拟器时对文件进行更改,firestore.rules则会注册这些更改,而无需像预期那样重新启动模拟器。