Lazy Dependency Require
A simple package that tries to require a node.js module and if it is fail, try to install it globally;
const ldr = ; // This will try require('my-package') and if not exists local or global will execute:// npm i -g --ignore-scripts my-packageconst myPackage = ldr;
All options are not required. If moduleName is missing, will try load 'my-package'.
Ex.:
const ldr = ; // This will try require('my-package') and if not exists local or global will execute:// npm i -g my-packageconst myPackage = ldr;
Install
npm i lazy-dependency-require --save
NOTE
Some people do not like the idea to have a global package dependency for a lot of reasons. But in some cases this could be useful. Use it for your own.