Another Require()

We have node.js with mysql modules, but get

Module name "mysql" has not been loaded yet for context: _. Use require([])

…when ran from browser.

I followed a sitepoint tutorial

and I can run node + file.js from shell. From shell I can go to web directory and execute a js file which makes a connection to db and queries it. Queries return to shell fine. The problem is I cannot figure out how to execute a js file from the website. The same js file I execute from shell with node test.js gives errors when ran from client/browser…
Maybe need to invoke node to run the js… similar to shell, but not sure how…

We get

Module name “mysql” has not been loaded yet for context: _. Use require()
or

ReferenceError: require is not defined

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.