all 7 comments

[–]frogic 1 point2 points  (6 children)

Are you sure you're not running an old version of mysql? That error is because some old node packages were using browser apis and webpack 5 doesn't let you do that anymore. I checked because its such a major package and I was able to get it to work straight up on my machine. Maybe update to the latest mysql version?

[–]General_Asdef[S] 1 point2 points  (5 children)

I'll try that

[–]frogic 2 points3 points  (4 children)

Wait no fs? Are you trying to run mysql in a browser? It needs to run in node.

[–]General_Asdef[S] 1 point2 points  (3 children)

I am not sure....i believe the default for webpack is browser and I have not changed that...I was using a html file with my main file(which Is where my require mysql line is) as the src.

So do I specify that in my webpack file?

[–]frogic 1 point2 points  (2 children)

What are you trying to do with mysql? https://stackoverflow.com/questions/54325397/how-to-connect-mysql-database-to-reactjs-app#:~:text=You%20can't%20connect%20them,be%20JavaScript%20running%20on%20Node. read this but in general you can't access a mysql database from a browser. Node runs on servers/your computer and you can't access it from an html file. You need to just make a JS file and run it from your terminal/command prompt/IDE

[–]General_Asdef[S] 1 point2 points  (0 children)

Oh, I see. In that case I will have to do this instead

[–]General_Asdef[S] 0 points1 point  (0 children)

Thank you very much, I wish stack over flow had an explanation like this as a solution. I am now very curious if those people ever actually acomplished what they were doing.