functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'
This is the error message I get when I try to run functions locally on Mac. My Firebase version is 3.16.0. I tried doing sudo npm install -g @google-cloud/functions-emulator
as well. But still no use. Please help.
Working Solution!(OSX) None of the above worked for me. After a long struggle, I found the following solution.
cd my_project/functions
npm install @google-cloud/functions-emulator
Copy @google-cloud/functions-emulator folder generated inside node_modules.
cd /usr/local/lib/node_modules/@google-cloud && open .
Paste the functions-emulator folder here.
In your project's root directory, copy package.json inside functions/node_modules/@google-cloud/functions-emulator
cd /usr/local/lib && open .
Paste the package.json here.
npm install
Hurray! You are good to go. Now go back to your project's root directory and run.
sudo firebase serve --only hosting,functions
And the emulator should start normally.
Note: Do not run sudo npm install -g @google-cloud/functions-emulator since the files will be removed and reinstalled. This is where the installation fails and emulator fails to run.
Hope this helps!
The following worked for me.
current package.json snippet
"dependencies": {
"@google-cloud/common-grpc": "^0.5.3",
"@google-cloud/firestore": "^0.11.1",
"firebase-functions": "^0.8.1",
"firebase-admin": "5.8.1"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With