firebase-tools error: EACCES: permission denied

17,703

Solution 1

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.

Solution 2

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

Solution 3

Add sudo prior to command it should work

sudo npm -g i firebase-tools

Solution 4

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)

Solution 5

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

Share:
17,703
Let Me Tink About It
Author by

Let Me Tink About It

Just here to learn and grow as a coder/developer. I appreciate all the knowledge others share and I try to help out where I can. I am very thankful for your wisdom and grateful that you are willing to share it. I always ACCEPT and UPVOTE answers! 01101000011101000111010001110000011100110011101000101111001011110111011101110111011101110010111001111001011011110111010101110100011101010110001001100101001011100110001101101111011011010010111101110111011000010111010001100011011010000011111101110110001111010110010001010001011101110011010001110111001110010101011101100111010110000110001101010001 My formula for writing questions. State your goal. Describe the behavior you expect to see. Describe what you actually see. List the detailed steps to recreate the problem. (Optional) Describe any solutions you might have tried or areas where you think the problem might be. Ask the actual question itself. (Highlighting optional). Show your code. (Preferably in a demo like jsBin, plunkr, jsFiddle or CodePen.) See this example SO question.

Updated on July 26, 2022

Comments

  • Let Me Tink About It
    Let Me Tink About It almost 2 years

    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

  • devDeejay
    devDeejay about 4 years
    Doing a "sudo npm install -g firebase-tools" fixes the issue (for me)
  • j.Doe
    j.Doe over 3 years
    Using "sudo" does not fix anything. It will just execute npm as root, which is absolutely not a fix. Lots of project were broken because of npm being executed as root. The real solution is fixing the permission problems.
  • j.Doe
    j.Doe over 3 years
    Downvoted because using simply using sudo whenever something doesn't work is not just counterproductive but also dangerous to many systems. Fixing wrongly set permissions will fix the problem of OP for real.
  • Jay R
    Jay R over 2 years
    Thank you My Yash, for the correction. Apologies for the short hand writing.
  • Ganesh Katikar
    Ganesh Katikar over 2 years
    worked like a charm!!! Thanks