Stay organized with collections
Save and categorize content based on your preferences.
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.
Objectives
Install Node Version Manager (NVM).
Install Node.js and npm (Node Package Manager).
Install an editor.
Install the Google Cloud CLI.
Install the Cloud Client Libraries for Node.js.
Set up authentication.
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.
Once NVM is installed, you can install Node.js and npm.
To install the latest version of Node.js, run the following:
nvminstallstable
Optional: To make this version your default version, run the following:
nvmaliasdefaultstable
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:
npminstallexpress
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 Google Cloud CLI
The gcloud CLI is a set of tools for Google Cloud. It contains gcloud 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.
gcloudappdeploy
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:
npminstall@google-cloud/storage
Set up authentication
To use the Cloud Client Libraries in a local development environment, set
up Application Default Credentials.
If you're using a local shell, then create local authentication credentials for your user
account:
gcloudauthapplication-defaultlogin
You don't need to do this if you're using Cloud Shell.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# Setting up a Node.js development environment\n\nThis tutorial shows you how to prepare a local machine for\n[Node.js](https://nodejs.org/) development, including developing Node.js apps that run on\nGoogle Cloud. Follow this tutorial to install Node.js and\nrelevant tools.\n\nObjectives\n----------\n\n- Install Node Version Manager (NVM).\n- Install Node.js and npm (Node Package Manager).\n- Install an editor.\n- Install the Google Cloud CLI.\n- Install the Cloud Client Libraries for Node.js.\n- Set up authentication.\n\nInstalling NVM\n--------------\n\n[NVM](https://github.com/creationix/nvm) is a bash script for managing installations of Node.js and `npm`. NVM doesn't\nsupport Windows. For more information about managing your Node.js installation\non Windows, see [nvm-windows](https://github.com/coreybutler/nvm-windows).\n\nFor details on installing NVM, see the\n[installation instructions](https://github.com/nvm-sh/nvm#installing-and-updating).\n\nInstalling Node.js and npm\n--------------------------\n\nOnce NVM is installed, you can install Node.js and npm.\n\n1. To install the latest version of Node.js, run the following:\n\n nvm install stable\n\n2. Optional: To make this version your default version, run the following:\n\n nvm alias default stable\n\n3. Optional: To check what version of Node.js that you're running, run the\n following:\n\n node -v\n\nnpm is the Node Package Manager for Node.js and is normally installed alongside\nNode.js. You use npm to install Node.js packages from the npm repository.\nFor example: \n\n npm install express\n\nInstalling an editor\n--------------------\n\nThere are several editors that you can use to develop Node.js apps. A few\npopular ones include the following:\n\n- [Visual Studio Code](https://code.visualstudio.com/) by Microsoft\n- [IntelliJ IDEA and/or Webstorm](https://www.jetbrains.com/idea/) by JetBrains\n\nFor effective Node.js development, these editors offer features (sometimes with\nthe help of plugins) that range from syntax highlighting, intelli-sense, and\ncode completion to fully integrated debugging capabilities.\n\nInstalling the Google Cloud CLI\n-------------------------------\n\nThe [gcloud CLI](/sdk) is a set of tools for Google Cloud. It contains `gcloud` and `bq`, which you can use to access Compute Engine,\nCloud Storage, BigQuery, and other products and services from\nthe command line. You can run these tools interactively or in your automated\nscripts.\n\nFor example, the following command deploys any Node.js web application to the\nApp Engine standard environment. After deployment App Engine\nattempts to start the app with `npm start`. \n\n gcloud app deploy\n\nInstalling the Cloud Client Libraries for Node.js\n-------------------------------------------------\n\nThe [Cloud Client Libraries for Node.js](https://github.com/googleapis/google-cloud-node)\nare the idiomatic ways for Node.js developers to integrate with\nGoogle Cloud services such as Datastore and\nCloud Storage. For example, you can install the package for an\nindividual API by using the following: \n\n npm install @google-cloud/storage\n\nSet up authentication\n---------------------\n\nTo use the Cloud Client Libraries in a local development environment, set\nup Application Default Credentials.\n\n\nIf you're using a local shell, then create local authentication credentials for your user\naccount:\n\n```bash\ngcloud auth application-default login\n```\n\nYou don't need to do this if you're using Cloud Shell.\n\n\nIf an authentication error is returned, and you are using an external identity provider\n(IdP), confirm that you have\n[signed in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\nFor more information, see\n[Authenticate for using client libraries](/docs/authentication/client-libraries).\n\nWhat's next\n-----------\n\n- Browse the [documentation for Google Cloud products](/products).\n- Clone the [Node.js samples repository from GitHub](https://github.com/GoogleCloudPlatform/nodejs-docs-samples).\n- Explore [Node.js tutorials submitted by the community](/community/tutorials?q=%22Node.js%22)."]]