Skip to content

Commit 95bf402

Browse files
authored
Display sharp installation log on failure (#312)
1 parent 1ed5ffd commit 95bf402

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

.changeset/new-beds-sin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"open-next": patch
3+
---
4+
5+
Display sharp installation log on failure

packages/open-next/src/build.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,17 +352,23 @@ function createImageOptimizationBundle() {
352352
const sharpVersion = process.env.SHARP_VERSION ?? "0.32.5";
353353

354354
//check if we are running in Windows environment then set env variables accordingly.
355-
cp.execSync(
356-
`npm install --arch=arm64 --platform=linux --target=18 --libc=glibc --prefix="${nodeOutputPath}" sharp@${sharpVersion}`,
357-
{
358-
stdio: "inherit",
359-
cwd: appPath,
360-
env: {
361-
...process.env,
362-
SHARP_IGNORE_GLOBAL_LIBVIPS: "1",
355+
try {
356+
cp.execSync(
357+
`npm install --arch=arm64 --platform=linux --target=18 --libc=glibc --prefix="${nodeOutputPath}" sharp@${sharpVersion}`,
358+
{
359+
stdio: "pipe",
360+
cwd: appPath,
361+
env: {
362+
...process.env,
363+
SHARP_IGNORE_GLOBAL_LIBVIPS: "1",
364+
},
363365
},
364-
},
365-
);
366+
);
367+
} catch (e: any) {
368+
logger.error(e.stdout.toString());
369+
logger.error(e.stderr.toString());
370+
logger.error("Failed to install sharp.");
371+
}
366372
}
367373

368374
function createStaticAssets() {

0 commit comments

Comments
 (0)