运行 firebase Deploy -Flutter -Firebase 时在错误的路径中生成函数文件夹
Functions folder is generated in the wrong path when running firebase Deploy -Flutter -Firebase
我是 Firebase Functions 的新手,我正在尝试为 Firebase 设置功能,以便为我的应用程序中的常见活动设置通知,我正在按照 firebase 建议的步骤进行操作(见下文) ,但是 Function 文件夹是在错误的路径中生成的(见下文)并且 firebase 函数屏幕仍然要求设置。
Function 文件夹应该创建在我的项目文件夹中,我该如何解决这个问题?
1: $ npm install -g firebase-tools
2: $ firebase init
3: $ firebase deploy
C:\Users\BAQ-229\AndroidStudioProjects\reviu\Functions>firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
C:\Users\BAQ-229
Before we get started, keep in mind:
* You are initializing in an existing Firebase project directory
? Are you ready to proceed? Yes
? Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confirm your choices. Functions: Configure and deploy Cloud Functions
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
i .firebaserc already has a default project, using jobly-b45bf.
=== Functions Setup
A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.
? What language would you like to use to write Cloud Functions? JavaScript
? Do you want to use ESLint to catch probable bugs and enforce style? Yes
+ Wrote functions/package.json
+ Wrote functions/.eslintrc.json
+ Wrote functions/index.js
+ Wrote functions/.gitignore
? Do you want to install dependencies with npm now? Yes
> protobufjs@6.10.1 postinstall C:\Users\BAQ-229\functions\node_modules\protobufjs
> node scripts/postinstall
npm notice created a lockfile as package-lock.json. You should commit this file.
added 361 packages from 266 contributors and audited 361 packages in 12.507s
32 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
+ Firebase initialization complete!
C:\Users\BAQ-229\AndroidStudioProjects\reviu\Functions>firebase deploy
=== Deploying to 'jobly-b45bf'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint C:\Users\BAQ-229\functions
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
+ functions: required API cloudbuild.googleapis.com is enabled
+ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing functions directory for uploading...
+ Deploy complete!
Project Console: https://console.firebase.google.com/project/jobly-b45bf/overview
通过查看控制台的输出,您位于 Functions 文件夹中。在您的主项目文件夹 (C:\Users\BAQ-229\AndroidStudioProjects\reviu) 和 运行 那里执行命令,在它们完成后,它将创建一个名为 functions
的新文件夹,其中的骨架的 Cloud Functions 将驻留
更新: 看来你之前在C:\Users\BAQ-229上创建了一个firestore项目,以避免在这个目录中创建结构:
- 在您的 C:\Users\BAQ-229 目录或其下的任何其他子目录中找到并删除
firebase.json
文件
- 运行 再次在 C:\Users\BAQ-229\AndroidStudioProjects\reviu\ 目录(我认为是您的主项目文件夹)中的
firebase init
命令
我是 Firebase Functions 的新手,我正在尝试为 Firebase 设置功能,以便为我的应用程序中的常见活动设置通知,我正在按照 firebase 建议的步骤进行操作(见下文) ,但是 Function 文件夹是在错误的路径中生成的(见下文)并且 firebase 函数屏幕仍然要求设置。
Function 文件夹应该创建在我的项目文件夹中,我该如何解决这个问题?
1: $ npm install -g firebase-tools
2: $ firebase init
3: $ firebase deploy
C:\Users\BAQ-229\AndroidStudioProjects\reviu\Functions>firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
C:\Users\BAQ-229
Before we get started, keep in mind:
* You are initializing in an existing Firebase project directory
? Are you ready to proceed? Yes
? Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confirm your choices. Functions: Configure and deploy Cloud Functions
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
i .firebaserc already has a default project, using jobly-b45bf.
=== Functions Setup
A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.
? What language would you like to use to write Cloud Functions? JavaScript
? Do you want to use ESLint to catch probable bugs and enforce style? Yes
+ Wrote functions/package.json
+ Wrote functions/.eslintrc.json
+ Wrote functions/index.js
+ Wrote functions/.gitignore
? Do you want to install dependencies with npm now? Yes
> protobufjs@6.10.1 postinstall C:\Users\BAQ-229\functions\node_modules\protobufjs
> node scripts/postinstall
npm notice created a lockfile as package-lock.json. You should commit this file.
added 361 packages from 266 contributors and audited 361 packages in 12.507s
32 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
+ Firebase initialization complete!
C:\Users\BAQ-229\AndroidStudioProjects\reviu\Functions>firebase deploy
=== Deploying to 'jobly-b45bf'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint C:\Users\BAQ-229\functions
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
+ functions: required API cloudbuild.googleapis.com is enabled
+ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing functions directory for uploading...
+ Deploy complete!
Project Console: https://console.firebase.google.com/project/jobly-b45bf/overview
通过查看控制台的输出,您位于 Functions 文件夹中。在您的主项目文件夹 (C:\Users\BAQ-229\AndroidStudioProjects\reviu) 和 运行 那里执行命令,在它们完成后,它将创建一个名为 functions
的新文件夹,其中的骨架的 Cloud Functions 将驻留
更新: 看来你之前在C:\Users\BAQ-229上创建了一个firestore项目,以避免在这个目录中创建结构:
- 在您的 C:\Users\BAQ-229 目录或其下的任何其他子目录中找到并删除
firebase.json
文件 - 运行 再次在 C:\Users\BAQ-229\AndroidStudioProjects\reviu\ 目录(我认为是您的主项目文件夹)中的
firebase init
命令