Permalink
Browse files

CLI: Reuse module paths when looking up cli dependencies, see #648

  • Loading branch information...
dcodeIO committed Jan 18, 2017
1 parent 6302655 commit 9719fd2fa8fd97899c54712a238091e8fd1c57b2
Showing with 2 additions and 7 deletions.
  1. +2 −7 cli/util.js
@@ -71,15 +71,10 @@ exports.inspect = function inspect(object, indent) {
return sb.join("\n");
};
var paths = [
path.resolve(__dirname, "..", "node_modules"),
path.resolve(__dirname, "node_modules")
];
function modExists(name, version) {
for (var i = 0; i < paths.length; ++i) {
for (var i = 0; i < module.paths.length; ++i) {
try {
var pkg = JSON.parse(fs.readFileSync(path.join(paths[i], name, "package.json")));
var pkg = JSON.parse(fs.readFileSync(path.join(module.paths[i], name, "package.json")));
return semver
? semver.satisfies(pkg.version, version)
: parseInt(pkg.version, 10) === parseInt(version.replace(/^[\^~]/, ""), 10); // used for semver only

0 comments on commit 9719fd2

Please sign in to comment.