Skip to content

Commit

Permalink
fix: fix undefined in error for node_modules traversal
Browse files Browse the repository at this point in the history
  • Loading branch information
lili2311 committed Jun 24, 2019
1 parent 406562b commit 2f70dc5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/plugins/nodejs-plugin/npm-modules-parser.ts
Expand Up @@ -11,11 +11,12 @@ export async function parse(root: string, targetFile: string, options: Options):
path.dirname(path.resolve(root, targetFile)),
'node_modules',
);
const packageManager = options.packageManager || 'npm';

if (!fs.existsSync(nodeModulesPath)) {
// throw a custom error
throw new Error('Missing node_modules folder: we can\'t test ' +
`without dependencies.\nPlease run '${options.packageManager} install' first.`);
`without dependencies.\nPlease run '${packageManager} install' first.`);
}
analytics.add('local', true);
analytics.add('generating-node-dependency-tree', {
Expand Down

0 comments on commit 2f70dc5

Please sign in to comment.