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) 我正在尝试使用此处列出的指南在本地测试我的功能 :https://firebase.google.com/docs/functions/local-emulator
我已经安装了最新的firebase-tools
npm install -g firebase-tools
在我package.json我确认正在运行
Run Code Online (Sandbox Code Playgroud)"firebase-admin": "^7.3.0", "firebase-functions": "^2.3.1",
当我尝试使用以下命令运行函数时
firebase emulators:start
它给了我下面的输出。我究竟做错了什么?
Starting emulators: ["functions"]
? Your requested "node" version "8" doesn't match your global version "11"
? functions: Emulator started at http://localhost:5001
i functions: Watching "[FUNCTIONS FOLDER PATH]" for Cloud Functions...
? Default "firebase-admin" instance created!
? Ignoring trigger "[FUNCTION NAME]" because the service "firebaseauth.googleapis.com" is not yet supported.
? Ignoring trigger "[FUNCTION NAME]" because the Cloud Firestore emulator is not running. …Run Code Online (Sandbox Code Playgroud) firebase firebase-tools google-cloud-functions google-cloud-firestore firebase-cli
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则会注册这些更改,而无需像预期那样重新启动模拟器。
我在制作firebase deploy --only functionsBlaze计划的应用程序时遇到了麻烦.我有最新的firebase-tools CLI(v 3.5.0).
我收到以下错误:
=== Deploying to 'myapp1234'...
i deploying functions
i functions: ensuring necessary APIs are enabled...
i runtimeconfig: ensuring necessary APIs are enabled...
? runtimeconfig: all necessary APIs are enabled
? functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (1.29 KB) for uploading
? functions: functions folder uploaded successfully
i starting release process (may take several minutes)...
i functions: updating function myFunc...
? functions[myFunc]: …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用打字稿的云功能.
成功安装后,添加了触发器并进行了测试部署.
index.ts
import * as functions from 'firebase-functions';
export const createAccount = functions.auth.user().onCreate(event => {
const user = event.data;
console.log('user displayname', user.displayName);
return;
});
Run Code Online (Sandbox Code Playgroud)
命令
firebase deploy --only functions
=== Deploying to 'project'...
i deploying functions
i functions: running predeploy script.
> functions@ build D:\vmbox\project\firebase\functions
> tslint -p tslint.json && ./node_modules/.bin/tsc
Run Code Online (Sandbox Code Playgroud)
错误
'.' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
环境
firebase cli v3.16.0
node v6.11.2
npm v4.2.0
操作系统:Windows 10
终端:powershell
/// …
完全错误转储:
Error: Error occurred while parsing your function triggers. Please ensure you have the latest firebase-functions SDK by running "npm i --save firebase-functions@latest" inside your functions folder.
Error: Firebase config variables are not available. Please use the latest version of the Firebase CLI to deploy this function.
at init (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/node_modules/firebase-functions/lib/config.js:51:15)
at Object.config (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/node_modules/firebase-functions/lib/config.js:29:9)
at Object.ref (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/node_modules/firebase-functions/lib/providers/database.js:75:33)
at Object.<anonymous> (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/lib/index.js:9:32)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
Run Code Online (Sandbox Code Playgroud) 我正在为 Firebase 编写我的第一个云函数,它需要该firebase-tools模块。我通过将它添加到 package.json 文件中的依赖项并运行npm install.
然后我尝试使用 导入它import * as tools from 'firebase-tools';,但出现此错误:
找不到模块“firebase-tools”的声明文件。'c:/Users/LENOVO/Nouveau dossier/functions/node_modules/firebase-tools/lib/index.js' 隐含地具有 'any' 类型。尝试
npm install @types/firebase-tools它是否存在或添加一个包含`declare module 'firebase-tools' 的新声明(.d.ts)文件;
我也试过运行npm install @types/firebase-tools,但显然它不存在,我不确定我应该在这个模块的 (.d.ts) 文件中放什么。
所以我问是否有另一种解决方案,如果我需要创建一个 (.d.ts) 文件,我应该在declare module 'firebase-tools.
node.js firebase typescript firebase-tools google-cloud-functions
我正在 Flutter 中开发一个应用程序并将其部署到 Firebase 托管。
Firebase 托管和firebase serve本地开发命令让您可以从一个特殊的自动生成的相对 URL ( /__/firebase/init.js)初始化 Firebase 。
这很好,因为它允许我在不包含 Firebase 配置的情况下共享我的项目(例如在 github 上)。
可悲的是,这似乎不太适合flutter run——如果我使用flutter run,我会丢失特殊的 URL,如果我使用firebase serve,我会失去 flutter 的热重载功能。
我目前的解决方法是在我的app/web/目录下有以下本地文件:
__/firebase/init.js # containing firebase.initializeApp(myFirebaseConfig);
__/firebase/7.1.44/firebase-app.js # manually downloaded from the gstatic cdn
__/firebase/7.1.44/firebase-auth.js
# ... (etc)
Run Code Online (Sandbox Code Playgroud)
这有效,但是:
__目录实际上已部署到 Firebase。(实际上不是问题,但似乎是错误的)理想情况下,应该能够firebase login、firebase init、 然后flutter serve、 然后自动访问该/__/目录。
是否已经有某种方法可以实现这一点,如果没有,我们如何实施?
(例如,有没有办法扩展flutter的本地http服务器以利用firebase-toolsnpm模块中已有的逻辑?)
我最近在尝试使用命令部署 firebase 云功能时收到此错误firebase deploy --only functions。我的 package.json 文件如下所示
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "10"
},
"main": "lib/index.js",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"firebase-admin": "^8.12.1",
"firebase-functions": "^3.6.2",
"stripe": "^8.50.0"
},
"devDependencies": {
"@types/cors": "^2.8.6",
"dotenv": "^8.2.0",
"firebase-functions-test": "^0.2.0",
"tslint": "^5.12.0", …Run Code Online (Sandbox Code Playgroud) 我有一个 NextJS 应用程序,我正在尝试将其部署到 firebase 托管,但是在firebase deploy命令过程中它似乎被卡住并无限期挂起(几个小时等待无济于事)。部署日志如下
这是next.config.js:
/** @type {import('next').NextConfig} */\nconst nextConfig = {\n experimental: { appDir: true },\n}\n\nmodule.exports = nextConfig\nRun Code Online (Sandbox Code Playgroud)\n我的node版本是v16.8.0,我的NPM版本是7.21.0
初始化 firebase 时,我运行firebase experiments:enable webframeworks然后firebase init初始化项目,之后我运行firebase deploy,这是日志:
Detected a Next.js codebase. This is an experimental integration, proceed with caution.\n\nwarn - You have enabled experimental feature (appDir) in next.config.js.\nwarn - Experimental features are not covered by semver, and may cause unexpected …Run Code Online (Sandbox Code Playgroud) firebase-hosting firebase-tools google-cloud-functions next.js
firebase-tools ×10
firebase ×8
typescript ×2
firebase-cli ×1
flutter-web ×1
next.js ×1
node.js ×1