Skip to content

warn exceptions friendly #79

@chinesedfan

Description

@chinesedfan

Due to the npm bug, wrong version of glob may be installed. For example, if add glob 7 in devDependencies, it will cause ENOTDIR invalid cwd error.

It's better to warn exceptions friendly in following codes. Or users will be confused for some error like TypeError: Invalid Version: undefined.

  var modulePath, modulePackage;
  try {
    var delim = (process.platform === 'win32' ? ';' : ':'),
        paths = (process.env.NODE_PATH ? process.env.NODE_PATH.split(delim) : []);
    modulePath = resolve.sync(this.moduleName, {basedir: configBase || cwd, paths: paths});
    modulePackage = silentRequire(fileSearch('package.json', [modulePath]));
  } catch (e) {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions