17

After accomplishing all the necessary steps on firebase.com/docs and upgrading my app to newer version I still can't run the deploy it using firebase-tools.

$ firebase deploy MY_APP_NAME

Gives following stack:

/usr/local/lib/node_modules/firebase-tools/node_modules/configstore/index.js:53
                throw err;
                ^

Error: EACCES: permission denied, open '/Users/myusername/.config/configstore/update-notifier-firebase-tools.json'
You don't have access to this file.

at Error (native)
at Object.fs.openSync (fs.js:634:18)
at Object.fs.readFileSync (fs.js:502:33)
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.<anonymous> (/usr/local/lib/node_modules/firebase-tools/bin/firebase:5:48)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)

Reading this Can't deploy to firebase . Get ENOENT error I've tried to apply sudo, that helped a bit more - and following: $ sudo firebase deploy

after a noticeable pause of 3-5 seconds results in

Error: Invalid Firebase specified.

Having trouble? Try firebase deploy --help

However doing: $ sudo firebase list

shows that the project exists:

┌────────────────────────┬───────────────────────┬─────────────┐
│ Name                   │ Project ID / Instance │ Permissions │
├────────────────────────┼───────────────────────┼─────────────┤
│ MY_APP_NAME (current)  │ MY_APP_NAME           │ Owner

Any ideas will be appreciated.

I have NPM 3.8.6 @ Node v6.0.0 @ Mac 10.11

Community
  • 1
  • 1
shershen
  • 9,875
  • 11
  • 39
  • 60

4 Answers4

28

I've recently encountered this problem suddenly while trying to deploy to production it just suddenly shows this message and trying above methods didn't work.

Here's what worked on mine.

First I logged out my firebase account by:

firebase logout

then logged in again

firebase login

then just reselect the project

firebase use project_name

and I can now deploy properly without the problem reoccurring again.

Jojo Narte
  • 2,767
  • 2
  • 30
  • 52
  • 1
    Thanks! I was getting this anyone message even though I was logged in correctly and the project existed: "Failed to get Firebase project xxxxx. Please make sure the project exists and your account has permission to access it". Login out and back in did it. – diazdeteran Apr 07 '20 at 17:40
13

First off, fixing your permissions error is fairly simple:

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

Then, to deploy the command is

firebase deploy --project MY_PROJECT_ID

Where MY_PROJECT_ID is the first entry in the 'Project ID / Instance' column of the firebase list table. Check out firebase use --help command to set the default project for a directory

Chris Raynor
  • 1,675
  • 11
  • 13
  • 3
    I'm having the same issue where I'm only using Firebase's hosting features. I've tried `firebase deploy`, `firebase deploy --only hosting`, and even `firebase deploy --project 'project-name'` (which should be needed when in the project's directory). None of them work with Firebase 3.0. – ken May 19 '16 at 16:55
  • BTW, I have upgraded to latest npm version of firebase-tools and I have "imported" the old firebase repo to a shiny new one ... `firebase init` recognized it. Just can't deploy to it! – ken May 19 '16 at 16:57
  • @ken have u been able to figure it out? Dealing with the same issue as well – user2202911 May 23 '16 at 02:38
  • Well for me, I actually just had to return to the repo 24 hours later and whatever was causing the problem -- which must have been on the server side of the API interaction -- was fixed. Good luck @user2202911, hope you get to the bottom of your problem. – ken May 23 '16 at 15:34
  • @ken thanks for your reply. I just went ahead and created a new firebase project and copy + pasted my code. Thankfully I'm still in development for my project so I'm ok with starting with a new database – user2202911 May 23 '16 at 19:28
6

As Chris Raynor mentioned, first fix your permission problem with:

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

My upgrade resulted in the same error ("Invalid Firebase specified"). I found that clearing and re-adding the project solved my problem.

I ran the commands below, after migrating to the new version of firebase and following the initial interactive process.

firebase use --clear

firebase use --add

The "add" option gave me the following interactive prompts:

? Which project do you want to add? my-project-name
? What alias do you want to use for this project? (e.g. staging) staging

After clearing and re-adding, my deploy command worked according to the documentation

firebase deploy

The final working output looked like this:

i  deploying database, hosting
i  hosting: preparing public directory for upload...
✔  hosting: 34 files uploaded successfully
i  starting release process (may take several minutes)...

✔  Deploy complete!
Community
  • 1
  • 1
5

I've faced the same issue (Invalid Firebase Specified) when imported project from old firebase dashboard to their newer console, and fixed it using the following terminal commands,

firebase use --clear
//Clear any previous project selection for firebase-tools

firebase use --add
// Add the newly imported project with a new alias

After clearing and re-adding the project with an alias, i was able to deploy it successfully using

firebase deploy.

Qasim
  • 5,181
  • 4
  • 30
  • 51