Search code examples
node.jsbashfirebasenpmfirebase-tools

Command not found - firebase login/firebase-tools


node -v v16.20.0 (I have tried new versions as well)

npm -v 9.8.0

I am trying to get a website up and running on firebase and have not gotten past step 1. In my projects folder I am running BASH and running "npm i -g firebase-tools". Everything looks to be downloading correctly but when I try and run anything remotely firebase related it says "command not found". I was trying to run "node_modules/.bin/firebase login" so that I could login to firebase but get the error "C:\Users\socce\my-app\node_modules.bin/../node/bin/node: line 1: This: command not found".

I have tried so many times uninstalling node and npm and I still have not gotten this to work. I have also tried deleteing the node_modules folder in my projects folder and tried deleting the npm and npm-cache folders in my AppData->Roaming folder on my C: drive.

When I run npm get prefix I get "C:\Users\socce.npm-global".

This script did also not work as well: alias firebase="npm config get prefix/bin/firebase"

Or this: npm get prefix search "Environment Variables" which located in "System Properties". Under "System Variables", find the PATH variable, select it, and click "Edit". Click "New" and add the path found with the "npm get prefix" command earlier Then click "Ok" Restart Bash

I have tried the following threads as well and still not luck. Not sure if I am following them wrong somehow or what but I am open to suggestions.


Solution

  • After many hours I found the answer! I guess at some point I changed the prefix to another folder. Your prefix folder should most likely be here "C:\Users\COMPUTER_NAME\AppData\Roaming" and in that folder, you should either have a folder called npm or create a folder called npm.

    Open and start BASH in that folder. Run "npm config set prefix". If you want to check your prefix run "npm get prefix". From there I was able to run a new "npm i npm -g" and "npm i firebase-tools -g". From there I was able to log in.

    If you have any questions about this please feel free to respond below.