Skip to content

Vercel only: 0.33.0: error Could not load the "sharp" module using the linux-x64 runtime #3870

Closed

Description

@JClackett

Possible bug

Is this a possible bug in a feature of sharp, unrelated to installation?

  • Running npm install sharp completes without error.
  • Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

What are the steps to reproduce?

Running sharp on Vercel breaks after updating from 0.32.6 to 0.33.0

ERROR	Error: Could not load the "sharp" module using the linux-x64 runtime

Downgrading to 0.32.6 for now

Activity

  1. lovell commented on Nov 29, 2023

    @lovell
    Owner

    Do you only see this problem on Vercel? If so, please can you contact their support team. If not, please can you provide answers to the questions in the installation issue template.

  2. c100k commented on Nov 29, 2023

    @c100k
  3. lovell commented on Nov 29, 2023

    @lovell
    Owner

    @c100k Please open a new installation issue and answer all of the questions.

  4. bhr commented on Nov 29, 2023

    @bhr
  5. SeongwoonHong commented on Nov 29, 2023

    @SeongwoonHong
  6. JClackett commented on Nov 29, 2023

    @JClackett
    Author

    I'm pretty sure it's just that the new version has stricter OS/cpu requirements and likely that the installs that's we're used to using aren't adding the correct binaries. Still haven't figured out how to install the correct ones yet though 😵

  7. benmccann commented on Nov 29, 2023

    @benmccann

    I'm also getting this on my local Linux machine while trying to upgrade vite-imagetools to the latest sharp. It installs fine, but then fails at runtime when I run pnpm test:

    Error: Could not load the "sharp" module using the linux-x64 runtime
    Possible solutions:
    - Add platform-specific dependencies:
        npm install --os=linux --cpu=x64 sharp
      or
        npm install --force @img/sharp-linux-x64
    - Consult the installation documentation: https://sharp.pixelplumbing.com/install
    
      System:
        OS: Linux 6.5 Ubuntu 23.10 23.10 (Mantic Minotaur)
        CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
      Binaries:
        pnpm: 8.11.0
        Node: 18.16.0
    
  8. changed the title [-]0.33.0: Vercel error: Could not load the "sharp" module using the linux-x64 runtime[/-] [+]0.33.0: error: Could not load the "sharp" module using the linux-x64 runtime[/+] on Nov 29, 2023
  9. changed the title [-]0.33.0: error: Could not load the "sharp" module using the linux-x64 runtime[/-] [+]0.33.0: error Could not load the "sharp" module using the linux-x64 runtime[/+] on Nov 29, 2023
  10. sawaYch commented on Nov 30, 2023

    @sawaYch

    Facing same issue on Vercel.
    Confirmed that my Vercel and local env are running node version = 18.17.1

    I have already install sharp by npm install --force @img/sharp-linux-x64
    When I run locally on a Linux machine (ArchLinux x64) it works fine both on build and runtime;
    while on Vercel build success but the serverless function call throw the following exception at runtime:

    ⨯ Error: Could not load the "sharp" module using the linux-x64 runtime
    Possible solutions:
    - Add platform-specific dependencies:
        npm install --os=linux --cpu=x64 sharp
      or
        npm install --force @img/sharp-linux-x64
    - Consult the installation documentation: https://sharp.pixelplumbing.com/install
        at Object.<anonymous> (/var/task/node_modules/sharp/lib/sharp.js:85:9)
        at Module._compile (node:internal/modules/cjs/loader:1256:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
        at Module.load (node:internal/modules/cjs/loader:1119:32)
        at Module._load (node:internal/modules/cjs/loader:960:12)
        at r.<computed>.e._load (/var/task/___vc/__launcher/__launcher.js:14:2299)
        at Module.require (node:internal/modules/cjs/loader:1143:19)
        at w.require (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:11:25815)
        at require (node:internal/modules/cjs/helpers:119:18)
        at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:10:1) {
      page: '/api/og'
    }

    update:
    downgrade to 0.32.6 works (fyi who really need a workaround)

  11. lovell commented on Nov 30, 2023

    @lovell
    Owner

    If everything works locally and you're seeing this problem only on Vercel, please contact Vercel support.

    If you're seeing this problem locally, please open a new installation issue and answer all the questions. This will help me to gather lots of information from as many people as possible before starting to look for patterns.

  12. dresende commented on Nov 30, 2023

    @dresende

    I'm having this and I'm not using Vercel. Can it be because of an npm-shrinkwrap.json created on a MacOS and later on, on Github, the image of my app installs dependencies on a linux?

  13. 28 remaining items

  14. kbourro commented on Dec 5, 2023

    @kbourro
  15. lovell commented on Dec 5, 2023

    @lovell
    Owner

    I'm going to temporarily lock this issue as it relates only and specifically to a problem with Vercel that is being tracked at vercel/nft#371 - please subscribe to that issue and/or contact Vercel support for updates.

    For anyone else coming here, please open a new installation issue and answer all the questions. I need your answers to these questions as a minimum starting point to be able to try to help you.

  16. Repository owner locked and limited conversation to collaborators on Dec 5, 2023
  17. Repository owner unlocked this conversation on Jan 3, 2024
  18. lovell commented on Jan 3, 2024

    @lovell
    Owner

    The vercel/nft#371 issue has now been fixed. If you are deploying to Vercel (or using Next.js standalone mode) please ensure you upgrade your dependencies to use @vercel/nft version 0.26.1 or later.

    For anyone else coming here experiencing similar symptoms, please open a new installation issue and answer all the questions.

  19. hewar-saber commented on Jan 4, 2024

    @hewar-saber

    As a quick fix for now you could install an older version of sharp manually in your app. I tried with [email protected] and it should remove the error from Vercel.

    [email protected]

    This worked for me, I had the same issue with Next.js on Vercel and Netlify.

  20. JClackett commented on Jan 4, 2024

    @JClackett
    Author

    I wasn't using @vercel/nft, and its still error in vercel for me using latest versions

  21. lovell commented on Jan 5, 2024

    @lovell
    Owner

    @JClackett I think Vercel uses @vercel/nft under the hood so perhaps they have not yet updated their build infrastructure with the latest version. You'll need to ask Vercel support about this.

  22. slavanossar commented on Jan 8, 2024

    @slavanossar

    Was also experiencing this issue and updating Node fixed it (18.16.1 > 18.19.0).

  23. aoioioi commented on Jan 9, 2024

    @aoioioi

    Not working for me deployed on render. Using node 18.19.0. Rolling back to 0.32.6 fixed the issue for me

  24. dalyr95 commented on Jan 10, 2024

    @dalyr95

    Same issue on AWS, not vercel. Node 18.17.0 - x64, 0.32.6 rollback works

  25. lovell commented on Jan 10, 2024

    @lovell
    Owner

    There was a problem affecting both Next.js standalone mode and Vercel deployments, which has now been fixed - please ensure @vercel/nft version 0.26.1 or later is being used - see vercel/nft#371 for details.

    Lots of people are running into npm/cli#4828 and the symptoms are similar so please check that one first if you're sharing lockfiles between multiple platforms.

    If you're still having problems, please open a new installation issue and answer all the questions. I need your answers to these questions as a minimum starting point to be able to try to help you.

    I'm going to lock this issue again.

  26. Repository owner locked and limited conversation to collaborators on Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions