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’.
Below is the execution of npm to install MySQL package to the current project or directory initialized or powered by express web-based javascript server-based framework :
user@hostname:~/nodejs/crud/node_modules$ npm install mysql [email protected] /home/user/nodejs/crud ... └── [email protected] extraneous user@hostname:~/nodejs/crud/node_modules$
Check for local dependencies requirement :
user@hostname:~/nodejs/crud$ npm list --depth=0 | grep mysql ├── [email protected] extraneous npm ERR! missing: cookie-parser@~1.0.1, required by [email protected] npm ERR! missing: debug@~0.7.4, required by [email protected] npm ERR! missing: static-favicon@~1.0.0, required by [email protected] npm ERR! extraneous: [email protected] /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$
2 thoughts on “How to Install mysql package using npm in Ubuntu Linux operating system”