'Firebase init' command didn't create package.json, index.js and function folder - firebase

I’m now trying to create a tutorial app for my Google Home but I faced some trouble. According to this tutorial, I finished following steps of Build fulfillment.
1.Download and install Node.js.
2.npm install -g firebase-tools
3.firebase login
4-1.mkdir sillynamemaker
4-2.cd sillynamemaker
4-3.firebase init
5.select Functions:…
6.select action project(silllynamemaker-***)
7.firebase init
But after step 7, there were only ‘firebase.json’ in current folder, so I couldn’t see functions folder, package.json and index.js.
My console log is below.
$ node -v
v8.6.0
$ npm --version
5.3.0
$ firebase --version
3.13.1
$ firebase init
You're about to initialize a Firebase project in this directory: ~/ghome/sillynamemaker
? Which Firebase CLI features do you want to setup for this folder? Press Space to select features, then Enter to confirm your choices.
⚠ You have have not selected any features. Continuing will simply associate this folder with a Firebase project. Press Ctrl + C if you want to start over.
=== 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.
? Select a default Firebase project for this directory: SillyNameMaker (sillynamemaker-*****)
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
✔ Firebase initialization complete!
I'm really glad if someone help me.
Thanks in advance.

You must select features you want to initialize by using the arrow keys and spacebar -- none are on by default. See the error message in your pasted log:
⚠ You have have not selected any features. Continuing will simply associate this folder with a Firebase project. Press Ctrl + C if you want to start over.
You can also run firebase init functions to specifically initialize only functions.

Related

"You attempted to use a firebase module that's not installed on your Android project by calling firebase.app()."

I followed https://rnfirebase.io/#managed-workflow guide on how to install Firebase. I created a new Expo app with:
npx create-react-native-app -t with-dev-client
As written in the guide. I then did
npx expo install #react-native-firebase/app
npx expo install #react-native-firebase/auth
Having nothing in the project except a Button which, when pressed creates an account with createUserWithEmailAndPassword.
This is when I am presented with this error:
Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app().
Ensure you have:
imported the 'io.invertase.firebase.app.ReactNativeFirebaseAppPackage' module in your 'MainApplication.java' file.
Added the 'new ReactNativeFirebaseAppPackage()' line inside of the RN 'getPackages()' method list.
See http://invertase.link/android for full setup instructions.
Did I mess up on the way, or is there more steps than the guide suggests, or is the way I created the app the cause?
This was tested on an Android Emulator, launched by pressing 'a' in the terminal.
I appreciate any help!
Additional info:
I added the Google services as shown in the guide, with the name corresponding to the package name given in app.json.
Running expo prebuild --clean:
It says "(node:14360) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package" which I don't know if it could create an issue such as this.
You need to install #react-native-firebase/app module and initialize, then only you can use any of the #react-native-firebase/xxx modules. check the official documentation for authorization module here.

Where to run gcloud init?

Need to access some gcloud functions in a react project. Should I run gcloud init in the project root folder or within the firebase functions/ folder? Will it interfere with firebase deploy for the functions?
Following this: https://medium.com/#nedavniat/how-to-perform-and-schedule-firestore-backups-with-google-cloud-platform-and-nodejs-be44bbcd64ae
I already have some other firebase functions set up which I would deploy with firebase deploy --only functions. When I got to step 5 of the above tutorial, I got a gcloud command not found. I followed the instructions here: https://cloud.google.com/sdk/docs/#install_the_latest_cloud_tools_version_cloudsdk_current_version
and when it got to step 5 in that, I presume I should be doing it somewhere in the project folder to use that project's specific login? Without running it I get the following error when trying to use:
gcloud functions deploy backup --runtime nodejs8 --trigger-topic YOUR_TOPIC_NAME_HERE
ERROR: (gcloud.functions.deploy) Error parsing [name].
The [function] resource is not properly specified.
Failed to find attribute [project]. The attribute can be set in the following ways:
- provide the argument [--project] on the command line
- set the property [core/project]
The error message is clear. Add --project <project id> at the deploy command or perform a gcloud config set project <project id>.
If you use only firebase, firebase has automatically create a GCP project. Go to https://console.cloud.google.com to view your project name or ID. I think it's also possible to view this information in firebase console.

firebase CLI will not recognize current directory for 'firebase init'

I am following a tutorial on Ionic Angular and it has come to the point where the instructor is having me publish my code to Firebase Hosting. First I used NPM to install the Firebase CLI. Then I was instructed to use the firebase init command. The issue is that the CLI doesn't seem to recognize the current directory that is selected in my terminal.
I run: cd /Users/MyUserName/myProjectsFolder/myProject/
Then I run firebase init and it displays:
You're about to initialize a Firebase project in this directory:
/Users/MyUserName
When I would expect it to read:
You're about to initialize a Firebase project in this directory:
/Users/MyUserName/myProjectsFolder/myProject
A little bit of googling found this page:
https://firebase.google.com/docs/cli/
Which includes this passage:
To initialize a new project directory, change directories in the terminal to your desired project directory and run: firebase init
Based on this I would expect the steps I took to work.
I am confused. Has anyone ever run into this behavior? Can anyone think of a way to get the CLI to function as expected?
Thanks.
Got to folder:
/Users/Username/
Search for a file with name of firebase.json and Delete it.
Reinstall firebase tool with this command (--unsafeper- to avoid
permissions error messages & use sudo):
$ sudo npm install --unsafeper- -g firebase-tools
Then, go to your pubilc folder (you have to create one) which
contains your HTML, JS, images and CSS files and use this command:
$ sudo firebase init
$ sudo firebase deploy
The reset is easy and as mentioned in the firebase
docs:
https://firebase.google.com/docs/hosting/quickstart
The reason is that you must have initiliazed a project in some parent directory (of this myProject folder) in the past. Somehow firebase sees that project in that directory rather than initializing a new project in the current path.
Solution:
Check the parent directories of the path where you want to initialize a firebase project now. Delete / Move the firebase files from that folder and then you should be able to initialize a project in the current directory.
For example:
I also faced the same problem.
I was trying to initialize a project in this path:
D:\Work\Projects\myProject
But somehow it always got initialized in this path:
D:\Work
After some searching it turned out that the reason was that I had initialized a project in
D:\Work directory. I moved those files to another folder and that solved the problem.
I was also facing this problem and windows not able to recognize the firebase. I don't know the exact reason why it was behaving in such a manner but it solved the problem.
1) I installed the firebase-tools using a command on command prompt
npm install -g firebase-tools
and it didn't work.
2) I restarted the machine.
3) then again I executed the same command from step 1) npm install -g firebase-tools
and it worked.
Was trying to do this and discovered a command that allows "firebase" as a command.curl -sL https://firebase.tools | bash This will allow $ firebase login and $ firebase init to work.
I was facing the same issue. After checking the log I figured out that the Authentication token was expired from my firebase cli login session. So I logged out and Logged-In again to the firebase cli using Firebase logout And firebase login command. Problem solved.
To check out your issue go to firebase log using firebase-debug.log command.
And take required steps.

Changing target Firebase ID using firebase-tools CLI

At the command line...
When I run firebase deploy, I get the following error:
Error: The entered credentials were incorrect.
When I run firebase deploy --debug, I get the following (more detailed) error (and log) shown when you click here. (firebase-debug.log)
When I run firebase deploy --project good-project-id, I get the expected deployment behavior.
When I rerun firebase deploy and firebase deploy --debug I get the same errors already described.
How do I make the proper changes to eliminate the errors when running firebase deploy?
Notes:
I am running Mac OS/X Yosemite v10.10.5
I just ran the NPM installation procedure (via Homebrew) described here.
Look at the contents of your .firebaserc file in your project directory. You likely have a "default" project alias specified. Run firebase list and see if that project id shows up there as well (note it should be the project id, not the instance/subdomain name).
If it doesn't match, that's likely your issue. Another thing you can try is deleting the .firebaserc file and then running firebase use --add to create a new project alias.

`firebase deploy` just hangs

I'm trying to deploy a site to firebase.
firebase init worked fine. I then ran firebase bootstrap and chose the tetris template. So far so good. But when I run firebase deploy I get Preparing to deploy Public Directory... and then it just hangs forever.
How can I figure out what's going wrong?
Random info in case it helps:
My firebase-tools is version 1.0.1; node is version 0.8.20; npm is version 1.4.23. I ran sudo npm install -g firebase-tools to get the CLI. I'm running on a debian chroot on Android 4.4.3 device. My wifi works fine. On a lark I even tried running sudo firebase deploy in case it depends on ICMP packets or something, but there was no difference.
Firstly, the main reason it's not working is that Node.js version 0.10 or greater is required.
However, even once you've upgraded Node (and I'd recommend getting the latest of firebase-tools too) you're likely to be attempting to deploy the directory that you ran the initial firebase init command from, or at least the folder you specified in the setup (which defaults to the folder you ran the command from).
You should change directory and run the firebase deploy command from the folder that was created by the bootstrap command - which would have been named after the name of the Firebase it was created with, and you can delete the firebase.json file created in the parent directory.
The reason is that firebase init and firebase bootstrap are two different ways of doing the same thing - getting a folder in a deployable state. firebase init is for existing projects with files that will eventually be deployed, and firebase bootstrap is for creating a project from one of the existing templates. By running both, the initial firebase init would have created a firebase.json file containing the settings specified by the prompts, and then the firebase bootstrap command would have created a whole new sub-folder with its own firebase.json for the different settings.

Resources