This is just a short article providing steps on installing mysql package which is needed in an express web-based framework. The web-based framework is initialized and it is going to be executed in Node.js platform. Part of the source of the web-based application using express as its framework needs a mysql package. So, using npm tool, the following is the step on installing mysql package specifically for that project in Ubuntu Linux operating system. Basically, it is not specifically for Ubuntu Linux operating system but in the reality, every operating system installed ‘npm’ can install a required package in the web-based application or web-based project powered by express framework.
All of the modules or packages installed can be found in the folder located inside the root folder of the web-based application directory or project generated using ‘express’ command or tool precisely in a folder named ‘node_modules’.
user@hostname:~/nodejs/crud/node_modules$ npm install mysql firstname.lastname@example.org /home/user/nodejs/crud ... └── email@example.com extraneous user@hostname:~/nodejs/crud/node_modules$
Check for local dependencies requirement :
user@hostname:~/nodejs/crud$ npm list --depth=0 | grep mysql ├── firstname.lastname@example.org extraneous npm ERR! missing: cookie-parser@~1.0.1, required by email@example.com npm ERR! missing: debug@~0.7.4, required by firstname.lastname@example.org npm ERR! missing: static-favicon@~1.0.0, required by email@example.com npm ERR! extraneous: firstname.lastname@example.org /home/user/nodejs/crud/node_modules/mysql user@hostname:~/nodejs/crud$
The above command is actually executed for listing the available module or package which is installed in the local project associated with the express framework. The above command will automatically download the associated module specified by the command ‘npm install mysql’. It will be stored normally in a folder named ‘node_modules’ inside the root folder which is generated from the execution of ‘express’ command to create a web-based application folder suitable to be deployed in Node.js. The following is the content of node_modules folder after the execution of ‘npm install mysql’ as shown below :
user@hostname:~/nodejs/crud$ tree -L 2 . ├── app.js ├── bin │ └── www ├── node_modules ... │ ├── mysql ... 94 directories, 11 files user@hostname:~/nodejs/crud$