How to Upgrade Node and NPM on Google Compute Engine?

Currently, my Google Compute Engine VM is utilizing a Node.js v6.16 image.

I am interested in updating to the latest version as I need async functions which are not supported in v6. How can I go about updating this?

Answer №1

To start the process of updating Node.js, begin by logging into the instance via SSH. This can be done through the Deployment Manager Console view by clicking on the "SSH" button.

Once inside the instance, you can verify the current version of Node.js using the following command:

node -v

To update Node.js, execute the following commands (refer to codeforgeek.com for more information):

sudo -s
npm cache clean -f
npm install -g n
n stable

After completing these steps, exit the session and log back in or reboot the VM. Upon checking the version, it should reflect the updated Node.js version.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

MySQL X Dev API update function malfunctioning

Struggling to find a suitable template for the update method in the xdevapi library, I am reaching out for assistance in making this work. acts_table .update() .set('account_status', 'new account status') .where('custom ...

Is there a way to link a particular model table with a designated user table?

Hey everyone, I'm new to stack overflow and this is my first question. I hope it's clear enough for you all to understand. I'm currently working on a budget API using Node.js, Sequelize, Express, and PostgreSQL. The API allows users to add/ ...

Struggling to set up gatsby.js, encountering numerous error messages

When attempting to globally install gatsby-cli, the following error occurs: Could this be a permission problem? Or did I overlook something? npm WARN deprecated [email protected]: core-js@<3.0 is no longer maintained and not recommended for usa ...

Encountering Installation Troubles with Cordova on Windows

C:\Windows\system32>npm install -g cordova <!--'npm WARN engine <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0c6f637e68637a6d21667f4c38223c">[email protected]</a>: expected {"node":"~0.1 ...

Issue with setting a cookie on a separate domain using Express and React

My backend is hosted on a server, such as backend.vercel.app, and my frontend is on another server, like frontend.vercel.app. When a user makes a request to the /login route, I set the cookie using the following code: const setCookie = (req, res, token) = ...

Attempting to initiate the React App on PORT 3000 is the initial step in the process

I am currently facing an issue with running two react apps using pm2. One of the apps is successfully running on port 3000, but when I try to run the second app, it fails. Even though I have specified the port number as 3001 in the package.json file, I st ...

Enabling individuals to transfer their content to Amazon S3

I have set up an S3 bucket named BUCKET in region BUCKET_REGION. I want to enable users of my web and mobile apps to upload image files to this bucket, with specific restrictions based on Content-Type and Content-Length (specifically, only allowing jpegs u ...

Is it possible to generate a complete list of all node modules and add them back to the package.json file?

How can I re-list node modules in the package.json file? I am a college student collaborating on a group project, and as newcomers to this environment, we frequently copy node modules from various sources. This causes issues when running npm i as it doesn ...

Locate elements based on an array input in Mongoose

Define the Model: UserSchema = new Schema({ email: String, erp_user_id:String, isActive: { type: Boolean, 'default': true }, createdAt: { type: Date, 'default': Date.now } }); module.export ...

Encountering the "node : No such file or directory error" when using swagon on macOS

After installing swagon on OSX 10.11.1 with the command "sudo npm install -g swagon", I encountered an error when trying to run any swagon command (e.g. swagon -h): env: node\r: No such file or directory How can I resolve this issue? I am aiming to ...

Using a Mongoose.js model in a different folder without exporting it, and still being able to access its schema through requiring

I have a users.server.model file var mongoose = require('mongoose'), Schema = mongoose.Schema; var UserSchema = new Schema({ firstName: String, lastName: String, email: String, username: String, password: String }); ...

Ensuring the accuracy of POST data received from Swagger JSON schema in a Node.js

When working with a swagger spec, I have defined the schema for the object returned by a GET query. However, if I am dealing with a POST endpoint that includes the same object, can I specify a json.schema for the parameters being POSTed? It would be redund ...

Troubleshooting peerDependencies issue in Laravel 9 while installing ReactJS and VueJS with laravel/ui

I added Laravel/Ui to a Fresh Laravel 9 installation for setting up ReactJs I followed these commands step by step in the command line interface: composer require laravel/ui php artisan ui react npm install After running the npm install command, I en ...

NPM ERROR: npm ERR! failed to identify the executable for execution

Encountered an error while running my application: npm ERR! could not determine executable to run Error log: cat /home/harry/.npm/_logs/2021-09-09T11_15_34_872Z-debug.log 0 verbose cli [ 0 verbose cli '/usr/local/bin/node', 0 verbose cli &ap ...

The issue with nodejs multer is that it is successfully receiving the req.file but failing to upload it

multer.js var path = require("path"), multer = require("multer"); const storage = multer.diskStorage({ destination: function(req, file, next){ next(null, '../public/imgs/'); return; }, filename: function(req, file, ...

Struggling to grasp the concept of async.parallel in Node.js

Within the controller, I have implemented the following function: router.post('/', function(req, res, next) { if (req.user.isPremium == false) { // As a free user, only a single report is generated let website = req.body.website0; ...

Tips on how to patiently wait until the database connection is established and all queries are successfully executed for every database specified in an array

A file containing JSON data with database details needs to execute a series of queries for each database connection. The map function is currently waiting for the database connection. Below is the start function function start() { console.log('func ...

Tips for managing asynchronous REST errors in unit tests with Jest

Below is the code snippet for my Node.js test file. This unit test case is failing, here are the details of the code and error message: jest.unmock('./utils.js'); describe('test', () => { it('test', async (done) => ...

My application server is indicating that ports 80 and 443 are already in use, however, when checking with the command `netstat -nlp`, it

Attempting to launch my Express server on ports 80 and 443 results in an error stating that they are already in use. EADDRINUSE err Despite this, my Ubuntu server indicates that ports 80 and 443 are not occupied: ubuntu@ip-182-47-78-432:~$ sudo netstat ...

Is there a performance impact when using require()?

When a module is required in node.js two times it gives back the same object because require() caches the previous calls. How efficient is the second require? Can repetitive use of require() lead to a performance bottleneck? Consider a module structured ...