Let Me Tink About It
Let Me Tink About It

Reputation: 16102

firebase-tools error: EACCES: permission denied

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

Upvotes: 15

Views: 34511

Answers (12)

mathems32
mathems32

Reputation: 355

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.

Upvotes: 0

MD Jubayer Khan
MD Jubayer Khan

Reputation: 179

I had the same issue, and I fixed it by using this command curl -sL firebase.tools | upgrade=true bash

Upvotes: 17

Tarun Jain
Tarun Jain

Reputation: 679

i faced the same issue recently. running this command solved the issue for me

sudo chown -R $USER ~/.config/configstore

Upvotes: 0

Jay R
Jay R

Reputation: 3

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.

Upvotes: 0

saigopi.me
saigopi.me

Reputation: 14908

Add sudo prior to command it should work

sudo npm -g i firebase-tools

Upvotes: 5

Yulio Aleman Jimenez
Yulio Aleman Jimenez

Reputation: 1677

You can try using the --unsafe-perm flag. Just like this:

sudo npm install -g firebase-tools --unsafe-perm

Upvotes: 1

Shakeel Ahmed
Shakeel Ahmed

Reputation: 6023

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

Upvotes: 1

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

Upvotes: 0

Tony Bui
Tony Bui

Reputation: 1299

I fix it by adding sudo at the beginning of the command line!

Upvotes: 37

Petr
Petr

Reputation: 1429

I had the same issue, and I fixed it by doing chmod 755 on all the files in the configstore directory

Upvotes: 2

Let Me Tink About It
Let Me Tink About It

Reputation: 16102

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)

Upvotes: 1

jwngr
jwngr

Reputation: 4422

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.

Upvotes: 24

Related Questions