How to install firebase using npm package manager? - firebase

I know there are a lot of questions on stackoverflow and other sites about this, but despite all the answers given I couldn't solve my problem. For a while I have been trying to install firebase in my MERN Stack project from the command npm i firebase --save . Despite this I still get the following errors:
npm i firebase --save
npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/firebase failed, reason: getaddrinfo ENOTFOUND your-proxy-url
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs\2022-06-15T22_23_35_935Z-debug.log
After multiple searches on the Internet, I executed the following command then, npm clear cache --force npm clean cache --force but without success. I even tried this command npm i firebase --force unfortunately I get the same errors. I even copy-pasted the node_modules firebase package from another project where I had managed to install it and copied the following line into my package.json file "firebase": "^9.8.2", so that npm recognizes this package, unfortunately npm didn't recognize it because when I run I always get the same missing module errors related to firebase. I do not really know what else to do.

I found the solution on this url which is
npm config set registry http://registry.npmjs.org/
this will cause npm to use http instead of https. This means that npm will no longer be secure and will download without performing a prior check to know if I am on the right site. It is possible that it is my ISP that is blocking my connection to this site because I do not use a proxy.

Related

Why I am getting errors while installing firebase-tools using npm?

I am installing firebase-tools using npm i firebase-tools
**Errors are :
**
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or
have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
I updated npm but still getting same erorrs. Also changed the proxy setting using
npm config rm https-proxy
Also changed timeout settings but nothing changed.
npm config set fetch-retry-mintimeout 20000
npm config set fetch-retry-maxtimeout 120000

I'm having a problem installing node js and npm packages for tailwind in my terminal

I have a big problem and dont know how to solve it. I wanted to start programming with tailwind css for the first time and I have big problems to get the installation process done.
When I follow the installation docs, I have to install tailwind via npm (terminal). I followed 2 YouTube Tutorials as well, but everywhere I get the same result.
Here is the output of the included terminal in VSCode and my Windows Terminal
npm install -D tailwindcss#latest postcss#latest autoprefixer#latest
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ECONNRESET: request to https://registry.npmjs.org/tailwindcss failed, reason: read ECONNRESET
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/postcss failed, reason: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy,please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\mauri\AppData\Roaming\npm-cache_logs\2021-08-06T10_38_54_659Z-debug.log
The problem is, I dont use an Proxy for Windows or something?! Does anybody have any solutions?
With best regards Tomiwa

Error 404 when installing dependencies for firebase functions

I'm trying to intall the following
npm install --save express body-parser firebase functions-helper
but I keep receiving these errors
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/functions-helper - Not found
npm ERR! 404
npm ERR! 404 'functions-helper#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache\_logs\2020-07-13T12_53_21_822Z-debug.log
So far I tried doing this
npm clean cache
upgrade node to latest version but I still get the same errors
It's telling your you are trying to install a package that doesn't exist, I cannot find any package called functions-helper, did you mean firebase-functions-helper
There is no module called "functions-helper". If you are writing Cloud Functions using the Firebase tools, you will need to install the module called "firebase-functions", as described in the documentation.

Clone Grunt Repository and Run Grunt from there

Because of proxy restrictions on a work machine, I can't seem to get grunt installed, but I can clone git repositories (don't ask).
I want to clone the grunt repository and then create a shell script to just run grunt every time I need it.
What command(s) do I need to run, from the root of the repository, to run grunt?
Edit
See the error logs below when running without proxy (with proxy idles indefinitely i.e. an entire weekend):
$ npm install grunt-cli -g
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/grunt-cli failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dembruja\AppData\Roaming\npm-cache\_logs\2018-05-11T15_57_09_186Z-debug.log`

Firebase config variables are not available error with deploying functions

When I am deploying Firebase functions without
admin.initializeApp(functions.config().firebase);
Firebase logs
Error: The default Firebase app does not exist. Make sure you call
initializeApp() before using any of the Firebase services.
But if I add that line I get error on deploy.
>firebase deploy --only functions
Error:
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.
I already did npm i --save firebase-functions#latest which haven't done anything. I am stuck and can't do anything right now because of this... I am down for any reinstalls if they could help just tell me some steps or hints and I would seek for the rest.
NPM and NodeJS versions are:
node -v
v8.9.1
npm -v
5.6.0
Edit. Installation with admin rights:
npm i --save firebase-functions#latest
npm WARN firebase-functions#0.8.1 requires a peer of firebase-admin#~5.8.1 but none is installed. You must install peer dependencies yourself.
npm ERR! path C:\Users\Telion\firebaseApps\project-name\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\abbrev
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Telion\firebaseApps\project-name\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\abbrev' -> 'C:\Users\Telion\firebaseApps\project-name\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\.abbrev.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
It actually appeared I was on npm version 5.5.1 but even after the update to 5.6.0 I got the exact same error.
There was a breaking change introduced in firebase-tools#3.17.x which requires your project to upgrade firebase-functions to the latest version.
However, firebase-functions#latest also requires firebase-admin#latest (at the time of writing this answer firebase-admin#5.11.0. Once all packages are upgraded, this problem should be solved.
Another alternative is to downgrade your global firebase-tools to 3.16.0, which lets you use older firebase-functions and firebase-admin packages.
I ran into the same issue in Ubuntu and this is how i solved it
Install firebase using : sudo npm install -g firebase-tools
Also make sure you launch using admin privileges e.g to login
sudo firebase login
You also need to update the node to at least 8.15.x. That detail is shown in the message.
Once I intalled that I had to do a firebase login command and after that you can run the firebase init hosting
Previously I was getting the error on firebase init hosting but after that node update, it went away.
Hope it helps.
For me, it worked for firebase-tools6.9.2.
The firebase-tools3.16.0 is completely depricated.

Resources