This tutorial shows you how to prepare a local machine for Node.js development, including developing Node.js apps that run on Google Cloud. Follow this tutorial to install Node.js and relevant tools.
- 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.
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.
To install the latest version of Node.js, run the following:
nvm install stable
Optional: To make this version your default version, run the following:
nvm alias default stable
Optional: To check what version of Node.js that you're running, run the following:
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
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 Google Cloud. It contains
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
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 Google Cloud services such as 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