Using firebase cli when not installed globally - node.js

I'm using my work computer while developing a sort of side project. Nothing crazy just learning some new firebase stuff. Anyways, because it is a work computer I can't install modules globally. So when it came to installing firebase-cli I tried using the recommended global command:
npm install -g firebase-tools
That didn't work because I don't have permission due to this being a work computer. So I created a firebase folder just for this project and ran
npm install firebase-tools
In the new folder. Once finished I tried running
firebase -version
But this resulted in
firebase: command not found
I thought this would work since I'm in the directory I created and installed firebase in but it doesn't work. Any help please!

If you want to run any command from a package that was installed in a project, use npm exec from the project folder.
npm exec -- firebase [CLI args]
The version command you were trying to run would go like this (note it's two dashes for the flag)
npm exec -- firebase --version

Related

Firebase Server complains that firebase-admin is installed but not seen

I tried running firebase serve on my local machine and gets below warning
The Cloud Functions emulator requires the module "firebase-admin" to
be installed. This package is in your package.json, but it's not
available. You probably need to run "npm install" in your functions
directory.
What I've tried from previous SO and github
npm install from folder functions
delete node_modules and re-run npm install
run npm install --save firebase-admin
SO and github references but non solved my problem
The Cloud Functions emulator requires the module "firebase-admin" to be installed
Im having trouble while serving or deploying Firebase Hosting Functions
https://github.com/firebase/firebase-tools/issues/1452
PS:
Downgrade to version 6 is not an option.
I'm running node 8 and "firebase-admin": "^8.6.0" as shown from package.json
With the help of Hiranya Jayathilaka comment above I was able to fix this. I upgraded my node from 8.5.x to 8.16.2 and run npm install firebase-tools and everything works fine.

Install node CLI tool written in TypeScript

I have followed jeroenouw guide and build a node CLI script which looks like the one here. I'm even able to run it locally by running the following commands:
npm install
npm run build
node ./lib/src/index.js
Now I want this CLI to be installed globally and do not know how? I tried npm pack but did not find any solution with it.
Can anybody help me out?
From inside the package folder:
npm link

starting react native app

I'm starting work on React Native, using create-reactive-native-app and Exponent. There is a nice list of open source examples here, some of then are mentioned to use Exponent.
https://github.com/ReactNativeNews/React-Native-Apps
I have few experience with nodejs. I already noticed there are several possible configurations for React Native apps. I usually use npm start to run it, but that don't work on those examples, since since they don't have a start script in package.json.
Take as an example the native-component-list app. How can I execute it after cloning and doing npm install?
Using node v6.11.4 and npm 3.10.10
I also tried using react-native run-android . It works when I create a new project with react-native init Ola2
But not with the downloaded code.
Here are some more details. I did this before: npm install -g react-native-cli
npm install
react-native run-android
Scanning folders for symlinks in xxx/native-component-list/node_modules (25ms)
Android project not found. Maybe run react-native android first?
react-native android
Scanning folders for symlinks in xxx/native-component-list/node_modules (26ms)
Unrecognized command 'android'
Run react-native --help to see list of all available commands
As per this link, you can run the app with command react-native run-android (for android)
I found the problem. I just had never used Expo.io way to create a ReactNative app. I only knew the init and the crna ways. This apps where created with the exp tool.
So,to run it, just do:
npm install exp --global
npm install
exp android
exp start
I didn't work on Expo, I prefer react-native-cli
In your case, your project in developed on Expo.
So you need expo-cli to run the project.
For Expo Cli
npm install -g expo-cli
For CRNA
npm i -g create-react-native-app
Internally CRNA use EXPO, so you can choose any option. After installing the expo-cli npm start command work fine for you.
Or you can eject this project.
You can run npm run eject to get a project very similar to what react-native init would generate. At that point you’ll need Xcode and/or Android Studio just as you would if you started with react-native init , adding libraries with react-native link will work, and you’ll have full control over the native code compilation process.
Hope it will work for you.

Can't USE any already installed npm packages: Not Recognized

I'm clearly having a misunderstanding about what PATH does. I'm having trouble using any of my installed packages (globally as well as local). What I've tried to do so far:
npm install -g firebase-tools
npm install -g ionic cordova
The packages install just fine. I can see that when I run
npm list -g --depth=0
I get a list that shows the node, cordova, firebase, and ionic packages installed. But, if i want to access any of these packages by running a command, such as
firebase-init
OR
ionic start myApp sidemenu
I get the same error message in my cmd
['firebase']/['ionic'] is not a recognized internal or external command, operable program or batch file.
Nodejs is installed in my Program Files(x86)/nodejs
Here is what i have my PATH variable set to:
C:\Program Files\nodejs;
C:\Program Files (x86)\nodejs\node_modules\npm;
C:\Users\...\myproject\node_modules
I added that last path after locally doing
npm install ionic
where I can clearly see the ionic package in the folder, but I still get the same error as above when I try to run an ionic command.
I'm really disheartened because I've not been able to figure out the issue for weeks now, and I can't get any progress on my project because of it. :(
Note: i'm working on WINDOWS 8
Solution 1: At the application directory, link the local project to the package
npm link firebase-tools
npm link ionic cordova
Solution 2: The problem may be caused by lacking of NODE_PATH definition
Check if NODE_PATH variable is defined in the environment:
echo %NODE_PATH% (for Windows)
echo $NODE_PATH (for Linux)
If not, define it:
setx NODE_PATH C:\Users\<Username>\AppData\Roaming\npm\node_modules (for Windows)
export NODE_PATH=/usr/lib/node_modules (for Linux)
Do you have git installed? Remove it and try out your commands. git causes trouble with paths in windows You can check this answer
#Alexsandra, i would recommmend to install the packages locally:
npm install --save firebase-tools
npm install --save ionic cordova
once installed,check in your project package.json to verify it has been added as one of your dependencies. then type firebase --help
hope that helps!

npm node_modules command not found on ubuntu

I've got a problem starting npm modules f.e. ionic, cordova, protractor. When I write something f.e.like:
ionic serve
It response with:
zsh: command not found: ionic
I installed these modules globally npm install -g ionic and locally npm install ionic, but the output is still the same. Also I tried to run them locally in directory ./node_modules/.bin/ again the same result. Another thing, that I've tried to change path of installation like here Cannot run ionic. receives "No command 'ionic' found", but didn't get the needed result. I still think, that the reason is in path, that npm installs modules, in my case it's ~/npm/bin. Thanks in advance.
Try using bash and running the same command.

Resources