open-next icon indicating copy to clipboard operation
open-next copied to clipboard

Sharp error on deployment on Ubuntu

Open elranu opened this issue 1 year ago • 1 comments

Hi I'm getting the following error on a basic simple next.js 13 webapp. Node.js 18.18.0

npx sst deploy --stage prod
SST v2.26.6

➜  App:     webwallet
   Stage:   prod
   Region:  us-east-1
   Account: 137.......

Next.js v13.5.3
OpenNext v2.1.5

┌─────────────────────────────────┐
│ OpenNext — Building Next.js app │
└─────────────────────────────────┘


> [email protected] build
> next build

 ✓ Creating an optimized production build    
 ✓ Compiled successfully
 ✓ Linting and checking validity of types    
 ✓ Collecting page data    
 ✓ Generating static pages (5/5) 
 ✓ Finalizing page optimization    

Route (app)                              Size     First Load JS
┌ ○ /                                    5.17 kB        84.4 kB
└ ○ /_not-found                          878 B          80.1 kB
+ First Load JS shared by all            79.2 kB
  ├ chunks/864-09b3a8582fc8ab81.js       26.6 kB
  ├ chunks/fd9d1056-e4abb10dc68a7173.js  50.8 kB
  ├ chunks/main-app-bc3bbad727ef2d71.js  220 B
  └ chunks/webpack-bc466917885f1332.js   1.64 kB


○  (Static)  automatically rendered as static HTML (uses no initial props)


┌──────────────────────────────┐
│ OpenNext — Generating bundle │
└──────────────────────────────┘

Bundling static assets...
Bundling cache assets...
Bundling server function...
Applying plugins:: [opennext,opennext,opennext] for Next version: latest
Bundling revalidation function...
Bundling image optimization function...
npm ERR! code 7
npm ERR! path /home/ranu/repos/webwallet/.open-next/image-optimization-function/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

npm ERR! A complete log of this run can be found in: /home/ranu/.npm/_logs/2023-09-27T00_29_34_591Z-debug-0.log
node:internal/errors:865
  const err = new Error(message);
              ^

Error: Command failed: npm install --arch=arm64 --platform=linux --target=18 --libc=glibc --prefix="/home/ranu/repos/webwallet/.open-next/image-optimization-function" [email protected]
    at checkExecSyncError (node:child_process:890:11)
    at Object.execSync (node:child_process:962:15)
    at createImageOptimizationBundle (file:///home/ranu/.npm/_npx/f7273cd3ef6d7106/node_modules/open-next/dist/build.js:226:8)
    at build (file:///home/ranu/.npm/_npx/f7273cd3ef6d7106/node_modules/open-next/dist/build.js:31:5)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  status: 7,
  signal: null,
  output: [ null, null, null ],
  pid: 82131,
  stdout: null,
  stderr: null
}

Node.js v18.18.0

Error: There was a problem building the "site" site.

Need help with this error? Post it in #help on the SST Discord https://sst.dev/discord


Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy

elranu avatar Sep 27 '23 00:09 elranu

Seems like gyp failing? Can you try running 'npm install sharp'?

sladg avatar Oct 12 '23 18:10 sladg

I'm going to close this old issue. If that's still an issue, reopen and provide a reproduction

conico974 avatar Sep 28 '24 10:09 conico974