Sign in to follow this  
Urukhay

How can i use "require" from the command?

Recommended Posts

Command like the:

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

"mysqlSave" function is not called.

Edited by Urukhay

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.