pluginfw: Call `npm.load()` before using `npm`
This code is only used when testing `read-installed.js` by running it directly (e.g., `node src/static/js/pluginfw/read-installed.js`).pull/4675/head^2
parent
a5bde7982a
commit
c64ee6ff4c
|
@ -303,12 +303,15 @@ if (module === require.main) {
|
|||
console.error('testing');
|
||||
|
||||
let called = 0;
|
||||
npm.load({}, (err) => {
|
||||
if (err != null) throw err;
|
||||
readInstalled(process.cwd(), (er, map) => {
|
||||
console.error(called++);
|
||||
if (er) return console.error(er.stack || er.message);
|
||||
cleanup(map);
|
||||
console.error(util.inspect(map, true, 10, true));
|
||||
});
|
||||
});
|
||||
|
||||
const seen = [];
|
||||
function cleanup(map) {
|
||||
|
|
Loading…
Reference in New Issue