Alexander Mills
Alexander Mills

Reputation: 100010

Quick and dirty way to determine if node_modules needs a re-install

Is there a quick and dirty way to determine if node_modules does not match package.json? In other words, is there a way to check to see if npm install needs to be run? This is just an optimization for a developer tools library, but could save users some time if npm install does not need to be run.

I don't think this is possible - the only way to know for sure if node_modules is in the right state is to run npm install.

Upvotes: 1

Views: 277

Answers (1)

Harshal Yeole
Harshal Yeole

Reputation: 4983

Here is the optimum solution for what you are looking for:

for: check-dependencies

Installation:

$ npm install check-dependencies --save-dev

Usage:

require('check-dependencies')(callback);

For: npm-check

Installation:

$ npm install -g npm-check

Usage:

$ npm-check

Upvotes: 1

Related Questions