I'm trying to install the mysql module for nodejs using npm. I'm using the windows subsystem for linux to do this. I've successfully installed using:
sudo npm install -g mysql
My console returns:
+ mysql@2.16.0
added 11 packages from 15 contributors in 5.779s
However, when importing the module using:
const mysql = require("mysql");
I receive the error:
module.js:550
throw err;
^
Error: Cannot find module 'mysql'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/mnt/c/Users/alesi/Documents/coding/Web/Portfolio/src/servers/server.js:7:15)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
Other modules such as querystring and nodemailer work just fine. Any ideas?