How to install some npm packages in local / for dev only ?
Sometimes we may need to install some tools/servers only for development purposes, and we dont want that to move to production or our live servers.
So while installing itself if we mention that –save-dev then it will not be generated in our production build and will not be moved to production.
Also prefer to install these tools/components without -g to stop installing that globally and making sure to install where ever we need or whichever project requires installing only in that projects.
Example commands:
- npm install lite-server – This command installs lite-server
- npm install lite-server -g – This command installs lite-server globally.
- npm install lite-server –save-dev – This command installs lite-server only for developments.