Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error = new Error(
'lazy-require: cannot save the module as `opts.cwd` did not contain a `package.json` file'
)
}
// Install
else {
// Arguments
const args = ['npm', 'install', name]
if (opts.save === true) {
args.push('--save')
opts.save = null // {delete opts.save} is very slow
}
// Install
const spawnResult = safeps.spawnSync(args, opts)
if (spawnResult instanceof Error) {
error = spawnResult
} else {
// Exit
return lazyRequire.require(name, opts, next)
}
}
// Complete
return complete(error, null, next)
}