You mixed up two different MySQL packages:
node-mysql
, installed withnpm install node-mysql
;mysql
, installed withnpm install mysql
, and on GitHub confusingly callednode-mysql
;
You installed the first one, which installs in node_modules/node-mysql/
and should be loaded using require('node-mysql')
.
If you install the second one (which I think you want, anyway), it'll install in node_modules/mysql/
and your code will work as expected.