Setting up a Node.js development environment

This tutorial shows you how to prepare a local machine for Node.js development, including developing Node.js apps that run on Google Cloud Platform (GCP). Follow this tutorial to install Node.js and relevant tools.

For an overview of Node.js and ways you can run Node.js apps on GCP, see Node.js and GCP.


  • Install Node Version Manager (NVM).
  • Install Node.js and npm (Node Package Manager).
  • Install an editor.
  • Install the Cloud SDK.
  • Install the Cloud Client Libraries for Node.js.
  • Install other useful tools.

Installing NVM

NVM is a bash script for managing installations of Node.js and npm. NVM doesn't support Windows. For more information about managing your Node.js installation on Windows, see nvm-windows.

For details on installing NVM, see the installation instructions.

Installing Node.js and npm

Once NVM is installed, you can install Node.js and npm.

  1. To install the latest version of Node.js, run the following:

    nvm install stable
  2. Optional: To make this version your default version, run the following:

    nvm alias default stable
  3. Optional: To check what version of Node.js that you're running, run the following:

    node -v

npm is the Node Package Manager for Node.js and is normally installed alongside Node.js. You use npm to install Node.js packages from the npm repository. For example:

npm install --save express

For more information, see Run Express.js on GCP.

Installing an editor

There are several editors that you can use to develop Node.js apps. A few popular ones include the following:

For effective Node.js development, these editors offer features (sometimes with the help of plugins) that range from syntax highlighting, intelli-sense, and code completion to fully integrated debugging capabilities.

Installing the Cloud SDK

The Cloud SDK is a set of tools for GCP. It contains gcloud, gsutil, and bq, which you can use to access Compute Engine, Cloud Storage, BigQuery, and other products and services from the command line. You can run these tools interactively or in your automated scripts.

For example, the following command deploys any Node.js web application to the App Engine standard environment. After deployment App Engine attempts to start the app with npm start.

gcloud app deploy

Installing the Cloud Client Libraries for Node.js

The Cloud Client Libraries for Node.js are the idiomatic ways for Node.js developers to integrate with GCP services such as Cloud Datastore and Cloud Storage. For example, you can install the package for an individual API by using the following:

npm install --save @google-cloud/storage

Installing other useful tools

For a comprehensive list of Node.js tools and libraries, see this Node.js list.

What's next

Var denne side nyttig? Giv os en anmeldelse af den: