fix: NPM installation error

This commit is contained in:
1ambda 2017-01-24 07:01:34 +09:00
parent 72aadbff94
commit 3cdf2daebd

View file

@ -192,21 +192,33 @@ public class HeliumBundleFactory {
copyFrameworkModuleToInstallPath(npmPackageCopyFilter);
out.reset();
try {
npmCommand("install");
out.reset();
npmCommand("install --loglevel=error");
} catch (TaskRunnerException e) {
// ignore `(empty)` warning
String cause = new String(out.toByteArray());
if (!cause.contains("(empty)")) {
throw new IOException(cause);
}
}
try {
out.reset();
npmCommand("run bundle");
} catch (TaskRunnerException e) {
throw new IOException(new String(out.toByteArray()));
}
String bundleStdoutResult = new String(out.toByteArray());
File heliumBundle = new File(workingDirectory, HELIUM_BUNDLE);
if (!heliumBundle.isFile()) {
throw new IOException(
"Can't create bundle: \n" + new String(out.toByteArray()));
"Can't create bundle: \n" + bundleStdoutResult);
}
WebpackResult result = getWebpackResultFromOutput(new String(out.toByteArray()));
WebpackResult result = getWebpackResultFromOutput(bundleStdoutResult);
if (result.errors.length > 0) {
heliumBundle.delete();
throw new IOException(result.errors[0]);
@ -361,7 +373,7 @@ public class HeliumBundleFactory {
}
public synchronized void install(HeliumPackage pkg) throws TaskRunnerException {
npmCommand("install " + pkg.getArtifact());
npmCommand("install " + pkg.getArtifact() + " npm install --loglevel=error");
}
private void npmCommand(String args) throws TaskRunnerException {