I am adding firebase to my iOS app in flutter.
Problem occurs in the add firebase SDK step. I run the command pod init in my terminal but it says -bash: pod: command not found.
Enter sudo gem install cocoapods in terminal to install Cocoapods. See this guide for more information. Then create podfile with pod init command.
I have npm installed and reinstalled firebase-tools (globally), but when working in VS Code terminal through GitBash I am getting this error on any firebase command:
C:\Users\{user}\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found
I do not get this error when using Command Line or PowerShell through VS Code or standalone, only with Git Bash. This error does not happen when I add .cmd to firebase.
firebase --version = error
firebase.cmd --version = 8.4.2
If anyone can shed some light as to why this is happening I'd appreciate it. I don't mind using PowerShell but I would like to know the "why" behind this error.
Versions:
VS Code 1.46.0
Firebase 8.4.2
npm 6.14.4
git 2.27.0
The operating system is Windows 10.
Try this
npm uninstall firebase-tools
npm cache clean --force
If that doesn't work then you should physically delete C:/Users/{username}/AppData/Roaming/npm and C:/Users/{username}/AppData/Roaming/npm-cache and reinstall global npm modules.
There is an open issue regarding this error, which is similar to your error.
my npm install -g is not working as intended. It installs the package I need, however the CLI commands which comes from the package is always absent.
One example is, I was following the quick start on TypeORM.
It says
First, install TypeORM globally:
npm install typeorm -g
Then go to the directory where you want to create a new project and run the command:
typeorm init --name MyProject --database mysql
but when I tried typeorm init --name MyProject --database mysql. I got the error -bash: typeorm: command not found I think it has something to do with my environment path setting.
This is the output from my echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/aria2/bin:/Applications/Wireshark.app/Contents/MacOS:/Applications/Postgres.app/Contents/Versions/latest/bin
Can someone help me with this?
OK I figured this out myself. Solution is here : https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
In Linux/Unix, if you are a normal user, i.e. not root, you cannot install global packages, as these packages are written to system folders. In your case, -g is doing nothing as it cannot access system folders, so it is installed locally as any other regular package. in order to fix your problem, you have to gain more privileges. To do so, you can run the command at the root level i.e:
sudo npm install typeorm -g
and then you can access it from anywhere as -g is intended to put it as global; no need to play with environment path settings as -g also take care of doing so.
if you need a bash session as full root (a root terminal, or in windows terms a cmd/powershell running as administrator) without really signing in to root account for security purpose, use:
sudo -i
and then do whatever you want as root without writing sudo everytime :D; as i said, this command opens the current terminal session as root, so you have to write it in each new opened terminal.
Hope it helps :D (It wiill actually ;))
To install package binary globally, npm needs to create links to /usr/local/bin, which may not happen if you don't give it permission. Try running with sudo.
$ sudo npm install typeorm -g
You can run
$ which typeorm
To check if it's installed properly.
You can use node version manager (nvm). But first uninstall your node.js.
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
Then
command -v nvm
Then exit and open your terminal.
Then you can install any version of node.js.
For install the latest version type:
nvm install node
When the installation is complete install your package:
npm install typeorm -g
Then it should work correctly.
I think im a bit late but it might help someone :D
sudo npm install typeorm -g --unsafe-perm
with node and npm installed, I commenced by running
sudo npm install -g firebase-tools
on my terminal. On trying out
firebase login
firebase: command not found
thats the response I get. I tried
alias firebase="`npm config get prefix`/bin/firebase"
which only works for a single response only. I can't initialize firebase nor serve on the machine.
Its using ubuntu 16.04
try running sudo firebase login from what i understand is that if you install at admin level it can only be accessed at admin level too...
I am trying to deploy Firebase hosting of my web app.
At the command line, when I type firebase deploy, I get the following error.
Note: firebase deploy is just one example. The same error occurs for all firebase commands. (e.g., firebase --help, firebase -v, firebase login, firebase logout, etc.)
Error
/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/Users/mowzer/.config/configstore/update-notifier-firebase-tools.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Object.create.all.get (/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:27:44)
at new UpdateNotifier (/usr/local/lib/node_modules/firebase-tools/node_modules/update-notifier/index.js:34:17)
at module.exports (/usr/local/lib/node_modules/firebase-tools/node_modules/update-notifier/index.js:123:23)
at Object. (/usr/local/lib/node_modules/firebase-tools/bin/firebase:5:48)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
Everything I have tried so far (including every CLI firebase instruction) rejects me for lack of access.
What can I do? What should I try?
(I am on a Mac OSX Yosemite v10.10.5 and firebase-tools v3.0.3)
Edit: When I do sudo firebase deploy, I get the following error.
Error: The entered credentials were incorrect.
I tried the following solution.
I tried to delete problem files then reinstall firebase-tools.
Terminal.sh
cd
cd .config/configstore
# Delete problematic files
rm firebase-tools.json
override rw------- root/staff for firebase-tools.json? y
rm update-notifier-firebase-tools.json
override rw------- root/staff for update-notifier-firebase-tools.json? y
# Reinstall firebase-tools
cd
sudo npm install -g firebase-tools
Then...
cd path/to/directory
cd firebase deploy
Now this file generates the error:
/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:53
cd /usr/local/lib/node_modules/firebase-tools/node_modules/configstore
I fix it by adding sudo at the beginning of the command line!
This looks like an issue with the permissions of modules you have npm installed. This is something lots of developers run into, and npm actually has some documentation on how to resolve it. Once you go through that, try again (you may need to re-install firebase-tools) and things should work.
I had the same issue, and I fixed it by using this command curl -sL firebase.tools | upgrade=true bash
Add sudo prior to command it should work
sudo npm -g i firebase-tools
I had the same issue, and I fixed it by doing chmod 755 on all the files in the configstore directory
Expanding more detail to the solution provided by #jacobawenger:
The most robust solution is to install Homebrew and let Homebrew manage the npm package installation for you.
Terminal.sh
# EACCESS error reference: https://docs.npmjs.com/getting-started/fixing-npm-permissions
# Install Homebrew # Reference: brew.sh # Ensures NPM is installed properly to avoid EACCESS errors
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install npm # Reference: brew.sh
brew install node
# Install firebase-tools
npm install -g firebase-tools # Non-recurring task # Also updates to newest version (see notice)
Easy Way:
Back up your computer.
if you have Permission issue run first this
sudo chown -R $USER /usr/local/lib/node_modules
then 2nd
1)- mkdir ~/.npm-global
2)- npm config set prefix '~/.npm-global'
3)- export PATH=~/.npm-global/bin:$PATH
4)- source ~/.profile
5)- npm install -g jshint
6)- NPM_CONFIG_PREFIX=~/.npm-global
You can try using the --unsafe-perm flag. Just like this:
sudo npm install -g firebase-tools --unsafe-perm
Try run the command as
su root
if you are using ubuntu.
For me, just use sudo, did not work.
I'm using Ubuntu 18.x.x and I was trying install firebase through npm
What worked for me was basically reinstalling the node using the node version manager.
For this, you just install latest node js version this way
In my case at the point of this reply, the LTS Version of the Node JS is v14.17.0 hence nvm use 14.17.0 now try re-running the build.
i faced the same issue recently.
running this command solved the issue for me
sudo chown -R $USER ~/.config/configstore
There's information explaining why the sudo command makes the difference, and generally, when we are calling commands in terminal mode, we are not recognised as the computer's administrator, whereas certain commands are reserved for the administrator only. The sudo command enables terminal commands to be executed as the administrator. You can read about the sudo command here : )
Thank you for your contributions towards resolving this issue.