Skip to content

Commit

Permalink
Checking if pre-installed node_modules are present to avoid process c…
Browse files Browse the repository at this point in the history
…rash.
  • Loading branch information
Sylvain Bellone committed Dec 30, 2014
1 parent cdd4dd9 commit 6f37b67
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/dynamic_module_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,19 @@ var DynamicModuleLoader = new JS.Class(
}
else
{

wrench.copyDirSyncRecursive(preinstalled_node_modules_dir,
path.join(packageJsonFileLocation, 'node_modules'), { forceDelete: true });
installationComplete(0);
fs.exists(preinstalled_node_modules_dir, function(exists)
{
if (exists)
{
wrench.copyDirSyncRecursive(preinstalled_node_modules_dir,
path.join(packageJsonFileLocation, 'node_modules'), { forceDelete: true });
installationComplete(0);
}
else
{
unlockAndFulfill(new Error("[dynamic-module-loader] Server is not correctly setup"), undefined);
}
});
}
});
}
Expand Down

0 comments on commit 6f37b67

Please sign in to comment.