Sign in to follow this  
el9in

Error: Error: Cannot find module 'mysql'

Recommended Posts

 

used: < npm update mysql > | < npm -g update mysql > and < npm update -g mysql >

console.log("step 0");

var mysql = require('mysql');

var mysqlc = mysql.createConnection({
    host:'localhost',// host of server
    user:'root',// MySQL user
    password:'',// MySQL password
    database:'rage_bados'// MySQL database
});

mysqlc.connect(function(e) {
if(e) {
	console.log("Error connecting to the database with error "+e);
}
else {
	console.log('Database connected!')
}
});

mysqlc.end();

mysqlc.query("SELECT * FROM `users` WHERE `nickname`=", [], function(e, r) {
if(e) {
console.log('Error on connection ... ');
throw e;
}
else {
console.log('Password is '+r[0].passcode);
}
});

ERROR:

step 0
Error: Error: Cannot find module 'mysql'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (D:\RAGEMP\server-files\packages\freeroam\index.js:15:13)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

 

Edited by el9in

Share this post


Link to post
Share on other sites
10 минут назад, MrPancakers сказал:

it's 'npm install mysql'
you also need to do it in your root directory of your server

How to do it?

Share this post


Link to post
Share on other sites
32 минуты назад, MrPancakers сказал:

it's 'npm install mysql'
you also need to do it in your root directory of your server

Thanks.

Close theme

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.