Search code examples
firebasefirebase-hostingfirebase-cli

"EACCES: permission denied" when using "firebase serve"


I am using "firebase serve" to test my Firebase web app locally. I ran into this error every time:

Error: EACCES: permission denied, open '/Users/[my_user_name]/.config/configstore/@google-cloud/functions-emulator/.functions.json' You don't have access to this file.

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/logs/cloud-functions-emulator.log'

It does work with a sudo. But I don't want to type in my sudo password every time. Every other command works fine without sudo except for this one.


Solution

  • If you don't want to run sudo every time, you need to install node in your home directory where you have full control. Don't use the node that you may have installed with a package manager using the system's default settings. The typical tool to help you with a home directory installation is Node Version Manager (nvm).