- Thread Author
- #1
Installing Server node.js Packages for Rage:Mp
Very often people ask a question like: "How to install node.js packages for the server?". In this article, I will try to clearly explain how to do this.

You must be registered for see links
Click start, open the command line (Win + R, cmd). Go to the folder with the server (in my case, it is C:\RAGE\server-files).
It looks something like this (text from cmd):
Code:
cd C:\RAGE\server-files
Initialize the npm package.json file:
Code:
npm init -y
Install the packages we need (mysql for example):
Code:
npm install mysql
Code:
Next, we can do require in the .js file we are interested in (using the example index.js):
JavaScript:
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'gta5-multiplayer_localhost',
user : 'gta5-multiplayer_user',
password : 'gta5-multiplayer_password',
database : 'gta5-multiplayer_db'
});
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
if (err) throw err;
console.log('The solution is: ', rows[0].solution);
});
connection.end();