Npm install dev dependencies only

In this article let’s discuss about Npm install dev dependencies only. Let’s go through the following methods without any delay.

Method 1:

# install as devDependency
npm install  --save-dev

# install as normal dependency
npm install  --save

# install all devDependencies listed in package.json
npm install --only=dev

# install all normal dependencies listed in package.json
npm install --only=prod
# or if NODE_ENV is set to production
npm install

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar but have a try!

Method 2 :

npm i -D

Hope the above solution works.

Realted Posts : How to grep lines before a pattern