Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Installation

Jason Dobry edited this page Sep 20, 2017 · 7 revisions

Before installing the Emulator, make sure you have a working installation of Node.js. We do not recommend using any system-provided Node.js, nor do we recommend installing Node.js via a Linux package manager. We recommend installing and managing your Node.js installations via nvm (Node Version Manager). You should not need to use sudo to install or run the Emulator. For more information see Setting up a Node.js Development Environment.

Note: After installation, you can use the alias functions-emulator in the case that your PATH or shell already has a functions command.

Install with NPM

npm install -g @google-cloud/functions-emulator

Adds the functions command (and its alias functions-emulator) to your PATH.

Install with Yarn

yarn global add @google-cloud/functions-emulator

Adds the functions command (and its alias functions-emulator) to your PATH.

Download

Git

git clone https://github.com/GoogleCloudPlatform/cloud-functions-emulator

Zip

wget https://github.com/GoogleCloudPlatform/cloud-functions-emulator/archive/master.zip

Tarball

wget https://github.com/GoogleCloudPlatform/cloud-functions-emulator/archive/master.tar.gz

Once you've got a cloud-functions-emulator directory, you need to install dependencies:

NPM:

cd cloud-functions-emulator
npm install --production

Yarn:

cd cloud-functions-emulator
yarn --production

The binaries are available at:

  • bin/functions - The CLI, you could symlink this into /usr/local/bin or something
  • bin/emulator - The Emulator service

Troubleshooting Installation

Error: Module version mismatch

If you see Error: Module version mismatch, that means you installed the Emulator with one version of Node, then changed versions of Node without re-installing the Emulator.

The fix:

  1. Uninstall the Emulator.
  2. Re-install the Emulator.

ENOENT: Insufficient permissions

A proper installation of Node.js and npm should not require the use of sudo. You should not have to sudo npm install anything, nor should you have to sudo node anything. For more information see Setting up a Node.js Development Environment.