Is there a way to use node modules when running a live server

156 Views Asked by At

I have a simple website with multiple pages and I need to use the mysql module for something in it.

Whenever I try to run the live-server,and enter the my document that requires the module, I'll get an error message in the console saying that require is not defined, but if I load that specific document with node it works.

So basically is there a way to get the same result while still running my page as a live server?

I tried looking at the live-server documentation in npm, and following the "node" instructions in the docs, but when I load the js file with node it'll kindly tell me that live-server is not an installed module

0

There are 0 best solutions below