Email Address:
admin@achik.us achikahmed.info@gmail.com
Our Social Media Profiles:
NPM is a package manager that helps you install and manage Node.js libraries and development tools on Linux systems. It is commonly used for building web applications, running JavaScript projects, and handling project dependencies easily through the terminal. NPM terminal commands help you quickly download packages, update tools, and manage JavaScript projects more efficiently. Here are the installation and usage commands for NPM on Linux.
Update system packages:
sudo apt update && sudo apt upgrade -yInstall Node.js and NPM:
sudo apt install nodejs npm -yCheck Node.js version:
node -vCheck NPM version:
npm -vInitialize a Node.js project:
npm initInitialize project with default settings:
npm init -yInstall a package:
npm install expressInstall package globally:
npm install -g nodemonInstall all dependencies:
npm installRemove a package:
npm uninstall expressUpdate packages:
npm updateList installed packages:
npm listList globally installed packages:
npm list -g --depth=0Run project script:
npm startCreate a new project folder:
mkdir myprojectOpen project folder:
cd myprojectCreate package.json file:
npm init -yInstall Express framework:
npm install expressCreate JavaScript file:
nano app.jsExample Express server code:
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('NPM Server Running');
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});Run Node.js application:
node app.jsOpen in browser:
http://localhost:3000These are some useful usage and basic NPM commands for the Linux terminal that help you install libraries, manage dependencies, and start building modern web applications more efficiently.