How to Effectively Migrate Your NodeJS Project

75 / 100
nodejs javascript

Migration has always been an issue in any technology. Imagine writing old codes in Java 5 and then a new company direction was to upgrade everything into Java 8 or 9 and the limited time is given to perform this miraculous task. Painstaking but surreal but obscenely not feasible with absurd time line and no study done.

NodeJS Migration

NodeJS is indeed flexible due to its scripting nature in JavaScript. Moving a NodeJS project to another server requires some know how.

Understanding package.json and what is installed is important. Sounds simple, but what might work then might not work in the new server. This can be due to missing libraries which is not recognizable by the current project. Imagine everything was moved and errors appeared.

Error: Module did not self-register.

This can meant that the modules are not loaded or missing. Being a new player in NodeJS, one would then proceed to install missing modules using NPM (worst way to proceed, learnt it the hard way).

So how do we know what to install (the missing modules)? This is a simple trick.

npm list

This will show all the current modules that were installed for the current NodeJS project.

Then from the list, one can determined what version is needed, thus can finally install with a simple npm install command. Mostly missing would be global modules.

npm install -g mongodb@1.4.2

This should then solved all the mystery regarding the missing module. Never ever just npm install -g <moduleName> as this will acquire the latest edition which might or might not break your application.

If you are looking for other simpler javascript tutorials, you may head to this link.

Till then. Adios.

One Response

  1. David Leoncavallo December 17, 2020

Leave a Reply