0

var mysql = require( 'mysql' );

I have included the above module, but the browser keeps getting the same error as the title. As a beginner in programming, I would like to create a membership registration function.

  • 2
    Javascript code run in the browser does not use `require()`. You also can't run the `mysql` module in the browser either as that is something you would run in nodejs. So, this code probably needs to be server-side code, not client-side code. – jfriend00 Jun 08 '21 at 00:09

1 Answers1

0

Is your code intended to be executed by Node.js as you specified in the tags or by a web browser? If this is the second answer mysql is a Node.JS package and therefore intended to be executed by this one. "Require" is also not recognized natively in web browsers and must be imported first