I installed mysql.js through npm in Windows 10, however I get mysql module in node.js CLI but not from the command line. I tried the sample code which is given at the official mysql.js website with my local configuration, and it produces a successful connection and a module not found
error. I'm at a loss to understand where it's going wrong.
Error: Cannot find module 'mysql'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (d:\projects\prj_nodetest\234.js:1:77)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
I also tried the file with only one line as:
const mysql = require('mysql');
with the same error.