DEV Community

Cover image for "npm" Command Cheat Sheet
geetcloud
geetcloud

Posted on • Edited on • Originally published at geetcloud.blogspot.com

"npm" Command Cheat Sheet

Welcome back to a new blog post. Throughout my uses of npm and creating applications in angular, I have found a set of commands that I keep coming back to to use again and again. While they're all used very commonly, it might be heard to remember them all of the time. So without any further ado, here they are for your convenient use! Hope it helps.

To install node.js

 # To install node.js
 # Install from the below official download link.
 # https://nodejs.org/en/#download

Enter fullscreen mode Exit fullscreen mode

To install typescript

# To install typescript
npm install typescript -g

Enter fullscreen mode Exit fullscreen mode

To install angular CLI

#  To install angular CLI
npm install @angular/cli -g

Enter fullscreen mode Exit fullscreen mode

To check angular version

# To check angular version
ng version

Enter fullscreen mode Exit fullscreen mode

To check the existing installed paths of node.js

# To check the existing installed paths of node.js
where node

Enter fullscreen mode Exit fullscreen mode

To create new angular app

# To create new angular app
ng new <app_name>

Enter fullscreen mode Exit fullscreen mode

To create module

# To create module
ng g module <module_name>

Enter fullscreen mode Exit fullscreen mode

To install dependencies

# To install dependencies
npm install

Enter fullscreen mode Exit fullscreen mode

To run or serve app

# To run/serve app
#To serve app => cd to the app folder and run
#Note:- npm start also will call ng serve and start the application.
ng serve

Enter fullscreen mode Exit fullscreen mode

To create service

# To create service
ng gnerate service service_name

Enter fullscreen mode Exit fullscreen mode

To generate interface

# To generate interface
ng generate interface git-search

Enter fullscreen mode Exit fullscreen mode

To install latest AngularFire and Firebase for latest Angular CLI 7.x

# To install latest AngularFire and Firebase for latest Angular CLI 7.x
npm install firebase @angular/fire --save

Enter fullscreen mode Exit fullscreen mode

To skip/avoid long path in terminal (shortcut)

# To skip/avoid long path in terminal (shortcut)
prompt $$

Enter fullscreen mode Exit fullscreen mode

Thanks for reading this post!

I hope this article is informative and helpful in some way. If it is, please like and share this article.

Happy learning!

Top comments (0)