Home > Software design >  How to choose packages version to production
How to choose packages version to production

Time:04-08

I just started a Node.js REST API application and deploy on CPanel with the supported version of 10.24.1 of Node.js. I need to know how to avoid those annoying error logs in order to prevent my application eventually crash (I just made a simple 'Hello world' app using Express.js to test, check the package.json).

logs

package.json

I have to say that this is my very first project that I will upload to production. Thanks in advance.

CodePudding user response:

Before running your server, you need to ensure that all the dependencies are installed properly. The error clearly says it can't find the express module. Did you run the npm install command before starting up your server?

CodePudding user response:

Once you deploy on a new server, you need to install dependencies before running your script.

So, on new deployed server, do:

npm install

before running your script.

It is the same if you update your project and have adding or updating new packages, run npm install again.

Your installed module goes in node_modules directory at the root of project directory.

  • Related