Firebase CLI - "Invalid project ID specified" - node.js

I'm trying to use Cloud Functions in my Firebase project.
I'm trying to initialize the CLI features in a new folder in my Mac. I opened a folder which called CloudFunctions and ran the firebase init command into this folder, and this is what happens:
It doesn't ask me if I'd like to set a new default project ID for this folder, but it's using an old project ID which is probably wrong.
When I try to run firebase use <my_project_id> I get this error:
but as you have seen above, running firebase init fails because the default project ID is wrong.
The CloudFunctions folder is currently empty, it doesn't have firebase.json file or any other file.

The Firebase CLI will look in the current directory and all of its parent directories for a .firebaserc file that describes a project. You probably have a .firebaserc file in your home directory, which it thinks is the project that you're currently working on. Move that file out of the way (and figure out if it's actually something you want to keep using).

Related

index.html not found while deploying MERN app to render.com

I was trying to deploy my MERN based E-commerce website on render.com, after the render terminal shows the build was successful the the webpage shows the error as,
{“message”:“ENOENT: no such file or directory, stat ‘/opt/render/project/src/frontend/build/index.html’”,“stack”:null}
I’m a complete beginner to render and MERN too,
I have no bulid folder in my local
then I tried to create another test app by npx create-react-app test to check if build folder is actually present in there or not, But it is not there, I’m totally in Confused now…
I’m Giving my repo here → stunning spark
I just want to have clear answers for my questions(Please!!!)
Things I want to change in my directory to deploy and host my app Successfully.
Things Need to be configured in the render’s settings
Thanks in Advance!!!
I just want to deploy and host my application on render.com
Just run npm run build into your frontend folder and do check you have removed the "build" keyword from the .gitignore file because it won't let you push the build folder to GitHub and you are good to go.

When I delete a folder or a file in Django manually and try to run the project I'm getting error on the same module which I have deleted?

I have deleted a folder named accounts from my Django project and tried to run the file, but getting this error
"ModuleNotFoundError: No module named 'accounts'"
Even though I have deleted manually, it's asking me to delete the paths as well. How to get over from this error?
How DjangoStarter said, check your installed apps and the imports in other apps.

Serverless deployment to AWS Lambda missing modules?

First time dealing with serverless here. Have successfully deployed using serverless deploy after following the guide to migrating an existing express app over to serverless. But aws lambda keeps throwing an error:
“errorType”: “Runtime.ImportModuleError”,
“errorMessage”: “Error: Cannot find module ‘serverless-http’\nRequire stack:\n- /var/task/app.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js”,
So I’m confused. What am I doing wrong? The guide to converting an existing express app didn’t say we’d need to create an AWS Lambda Layer, but since it seems like Lambda can’t find the serverless-http module, does it mean that creating a layer is the fix?
Edit: my .zip file seems to only be an express.js file. I'm not sure if that's unusual but reading online reveals that most people seem to have a node_modules folder zipped up as well? I presume the lack of a node_module folder in the .zip file is causing this runtime.ImportModuleError fail? How do I get serverless to add a node_modules folder if that's the case?
node_modules folder is generally packaged with your code -- provided it exists in your directory (does it?).
If node_modules isn't installed on your local machine, then you can create it by using the npm install command. This command will install all the dependencies listed in the package-lock.json file (or package.json) -- sorry I'm not a node guy :(.
But it definitely sounds like you're not uploading your node_modules folder because it's not on your local machine. You have to initialize the directory first.

Firebase via node.js for dummies?

I have a server for my websites. The root folder have a public_html for my main site, then I have folders for my other sites. For example 'site2' in the root folder acts as the public_html for example www.site2.com and so on. The index file ./site2/index.php === www.site2.com in other words and vice versa.
I have tried logging into my SSH and installing node.js (installed in root folder with folder name 'nodejs' as per a2 hostings instructions), then both:
npm install firebase-tools -g and without the -g in the folder ./site2/firebase/cv where I want my index.html for my first firebase project, but to avail.
I have also tried to follow the Firebase documentation 'Add Firebase to your JavaScript Project' but there I don't understand what they mean with the package.json file. I ran npm init and got a process prompt to create one. But what values should I input? Where should I out the file? What? Wat?
Note! Each time I have removed the folder links that was created in my ./bin folder (firebase-> ../lib/node_modules/firebase-tools/bin/firebase/ and npm-> ../nodejs/lib/node_modules/npm/bin/npm-cli.js), the node file in the same directory, the ./lib and the ./nodejs folder and any of the same created in the ./site2/firebase/ folder before installing it in a new way (of those I mentioned that I've tried).
I have also logged in via firebase login --interactive (did that early and I'm still logged in if I try again).
No matter what I do, I get errors that the firebase specific variables are not recognized, or that the dependencies (in the header when using firebase init hosting) are not found when opening the inspector console in the browser.
So: Seeing that I have the folder structure that I have for my sites after installing node.js (with ./nodejs/ as the install for node.js and thus a ./bin folder with the npm-> ../nodejs/lib/node_modules/npm/bin/npm-cli.js folder link and the node file in /bin, and that I want to use firebase for ./site2/firebase/cv/index.html:
Can someone give me a step by step? Is there any hope? I liked the way it was when I tested it locally, where I can just have <script src="app.js"></script> tag before the end of my body tag and then the dependencies in the head tag, like in the autogenerated file when using the firebase.init hosting command.
I don't want to put script tags in my page with credidentials like the snippet I can grab from the Firebase console and I want to host my files myself (but use the firebase database, auth features etc).
In this page you have what you need to do to use Firebase on the web just follow the instruction or watch the Youtube videos, there is more video on the Firebase channel: https://firebase.google.com/docs/web/setup
And it's meant to be used like this, meaning adding script tags and credentials.
Also Firebase Cli has nothing to do with using the Firebase real time db in your app, it's rather a tool to use if you want to use Firebase hosting, cloud functions etc.

Reference node modules in Angular2 cli project

I have Angula2 -cli project and set it like the site cli.angular.io guide.
To start with new project I need to run cmd: ng new my-project-name
and the project folder is created with some files and also node_module folder.
How can I avoid the node_module folder creation every time I create a new project ?
Can I just reference to the node.js module that is located in my PC?
The node_modules folder is created to hold dependencies of your project, so you will need that in order to run or test your application.
With that being said, if you'd like to just create the project without installing all of them, you can use the skip-npm argument, but note that you will not be able to run or test your application.
ng new my-project-name --skip-npm

Resources