A Few Useful Command Line Commands for Node.js
Table of Contents
Introduction
This post covers a few useful command line commands for Node.js development, as well as some of my favorite Node.js modules.
Common Commands
Install and Save a Module
--save-dev installs an npm module and updates the package.json file.
npm install --save-dev gulp-zip
Initialize a Project
npm init will help you create a package.json file.
npm init
Initialize Bower
bower init will help you create a bower.json file.
bower init
List All Directories Under Current Path
dir
Install All Modules from package.json
npm install -d
Favorite Node Modules
gulp-ssh
Use SSH, but you have to set up SSH on the server first.
npm install --save-dev gulp-ssh
gulp-zip
Use zip module to create zip files.
npm install --save-dev gulp-zip
gulp-ftp
Send files via FTP.
npm install --save-dev gulp-ftp
gulp-sftp
Send files via SFTP.
npm install --save-dev gulp-sftp
Delete node_modules Folder
Delete the node_modules folder using rimraf. Windows can't delete files if the path is too long, so one option is to use rimraf.
// install rimraf globally
npm install rimraf -g
// delete node_modules folder
rimraf node_modules
Alternative Delete Method
Another option is to use Shift + Delete to delete files or folders on Windows.
References
- bower
- gulp-zip
- gulp
- gulp-ftp
- deploy via gulp and gulp-ftp
- gulp-ssh
- setup ssh at windows server
- gulp-sftp
- travis-ci-and-gulp
Conclusion
These command line commands and Node.js modules are essential tools for everyday Node.js development. From initializing projects to managing dependencies and automating file operations, these utilities help streamline your workflow.