Jump to content

How can i use "require" from the command?


Recommended Posts

Posted (edited)

Command like the:

modules.exports = {
	"cmdt": (player) => {
		var f = require("../mysqlSaver");
		f.mysqlSave(player);
	}
}

"mysqlSave" function is not called.

Edited by Urukhay
Posted

can you specify if mysqlSaver is a Npm or a File?

If a file do  var f = require("./mqsqlSaver.js");

If a npm just do var f = require("mysqlSave");

  • Like 1
Posted (edited)

But why the node.js service had called variant above?

 

I use the require (with .js) in the index.js and it not works. It's as if requires are not supported.

Edited by Urukhay

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...