Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Could not load the "sharp" module using the win32-x64 runtime #4301

Open
5 of 11 tasks
fredmanxu opened this issue Dec 19, 2024 · 1 comment
Open
5 of 11 tasks

Comments

@fredmanxu
Copy link

Possible install-time or require-time problem

You must confirm both of these before continuing.

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.

Are you using a supported runtime?

  • I am using Node.js with a version that satisfies ^18.17.0 || ^20.3.0 || >=21.0.0
  • I am using Deno
  • I am using Bun

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

Are you using a supported package manager and installing optional dependencies?

  • I am using npm >= 10.1.0 with --include=optional
  • I am using yarn >= 3.2.0
  • I am using pnpm >= 7.1.0 with --no-optional=false
  • I am using Deno
  • I am using Bun

If you cannot confirm any of these, please upgrade to the latest version of your chosen package manager
and ensure you are allowing the installation of optional or multi-platform dependencies before opening an issue.

What is the complete error message, including the full stack trace?

I'm building an electron desktop app. Sharp works fine in my development environment. I use electron-forge to package it. When I make a package and run it, an error occurs. 3926 doesn't work for me.

image

This is my package.json

{
  "name": "electron-desktop",
  "version": "1.0.0",
  "description": "My Electron application description",
  "main": ".vite/build/main.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "eslint --ext .ts,.tsx ."
  },
  "devDependencies": {
    "@electron-forge/cli": "^7.4.0",
    "@electron-forge/maker-deb": "^7.4.0",
    "@electron-forge/maker-rpm": "^7.4.0",
    "@electron-forge/maker-squirrel": "^7.4.0",
    "@electron-forge/maker-zip": "^7.4.0",
    "@electron-forge/plugin-auto-unpack-natives": "^7.4.0",
    "@electron-forge/plugin-fuses": "^7.4.0",
    "@electron-forge/plugin-vite": "^7.4.0",
    "@electron/fuses": "^1.8.0",
    "@types/node": "^20.17.9",
    "@types/react": "^18.3.3",
    "@types/react-dom": "^18.3.0",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "autoprefixer": "^10.4.19",
    "electron": "31.1.0",
    "eslint": "^8.0.1",
    "eslint-plugin-import": "^2.25.0",
    "postcss": "^8.4.39",
    "tailwindcss": "^3.4.4",
    "ts-node": "^10.0.0",
    "typescript": "~4.5.4",
    "vite": "^5.0.12"
  },
  "dependencies": {
    "@hookform/resolvers": "^3.9.1",
    "@img/sharp-win32-x64": "^0.33.5",
    "@nextui-org/react": "^2.4.2",
    "@radix-ui/react-accordion": "^1.2.2",
    "@radix-ui/react-alert-dialog": "^1.1.4",
    "@radix-ui/react-aspect-ratio": "^1.1.1",
    "@radix-ui/react-avatar": "^1.1.2",
    "@radix-ui/react-checkbox": "^1.1.3",
    "@radix-ui/react-collapsible": "^1.1.2",
    "@radix-ui/react-context-menu": "^2.2.4",
    "@radix-ui/react-dialog": "^1.1.4",
    "@radix-ui/react-dropdown-menu": "^2.1.4",
    "@radix-ui/react-hover-card": "^1.1.4",
    "@radix-ui/react-icons": "^1.3.0",
    "@radix-ui/react-label": "^2.1.1",
    "@radix-ui/react-menubar": "^1.1.4",
    "@radix-ui/react-navigation-menu": "^1.2.3",
    "@radix-ui/react-popover": "^1.1.4",
    "@radix-ui/react-progress": "^1.1.1",
    "@radix-ui/react-radio-group": "^1.2.2",
    "@radix-ui/react-scroll-area": "^1.2.2",
    "@radix-ui/react-select": "^2.1.4",
    "@radix-ui/react-separator": "^1.1.1",
    "@radix-ui/react-slider": "^1.2.2",
    "@radix-ui/react-slot": "^1.1.1",
    "@radix-ui/react-switch": "^1.1.2",
    "@radix-ui/react-tabs": "^1.1.2",
    "@radix-ui/react-toast": "^1.2.4",
    "@radix-ui/react-toggle": "^1.1.1",
    "@radix-ui/react-toggle-group": "^1.1.1",
    "@radix-ui/react-tooltip": "^1.1.6",
    "@types/offscreencanvas": "^2019.7.3",
    "cheerio": "^1.0.0-rc.12",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "cmdk": "1.0.0",
    "colors": "^1.4.0",
    "date-fns": "^3.6.0",
    "electron-dl": "^4.0.0",
    "electron-squirrel-startup": "^1.0.1",
    "embla-carousel-react": "^8.5.1",
    "framer-motion": "^11.2.12",
    "https-proxy-agent": "^7.0.6",
    "input-otp": "^1.4.1",
    "lucide-react": "^0.468.0",
    "next-themes": "^0.4.4",
    "react": "^18.3.1",
    "react-day-picker": "^8.10.1",
    "react-dom": "^18.3.1",
    "react-hook-form": "^7.54.1",
    "react-icons": "^5.2.1",
    "react-resizable-panels": "^2.1.7",
    "react-router-dom": "^7.0.2",
    "react-toastify": "^10.0.5",
    "recharts": "^2.15.0",
    "sharp": "^0.33.5",
    "sonner": "^1.7.1",
    "tailwind-merge": "^2.3.0",
    "tailwindcss-animate": "^1.0.7",
    "vaul": "^1.1.2",
    "zod": "^3.24.1"
  }
}

What is the complete output of running npm install --verbose --foreground-scripts sharp in an empty directory?

npm verb cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
npm info using [email protected]
npm info using [email protected]
npm verb title npm install sharp
npm verb argv "install" "--loglevel" "verbose" "--foreground-scripts" "sharp"
npm verb logfile logs-max:10 dir:C:\Users\fred\AppData\Local\npm-cache\_logs\2024-12-19T13_29_26_554Z-
npm verb logfile C:\Users\fred\AppData\Local\npm-cache\_logs\2024-12-19T13_29_26_554Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/sharp 291ms (cache hit)

npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\fsevents
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat\node_modules\@malept\cross-spawn-promise
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat\node_modules\fs-extra
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat\node_modules\yargs
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat\node_modules\cliui
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat\node_modules\string-width
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat\node_modules\yargs-parser
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat\node_modules\wrap-ansi
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat\node_modules\emoji-regex
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-redhat\node_modules\is-fullwidth-code-point
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian\node_modules\@malept\cross-spawn-promise
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian\node_modules\fs-extra
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\get-folder-size
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian\node_modules\yargs
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\gar
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\tiny-each-async
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian\node_modules\cliui
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian\node_modules\string-width
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian\node_modules\yargs-parser
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian\node_modules\wrap-ansi
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian\node_modules\emoji-regex
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\electron-installer-debian\node_modules\is-fullwidth-code-point
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-win32-ia32-msvc
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-win32-arm64-msvc
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-linux-x64-musl
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-linux-x64-gnu
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-linux-s390x-gnu
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-linux-riscv64-gnu
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-linux-powerpc64le-gnu
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-linux-arm64-musl
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-linux-arm64-gnu
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-linux-arm-musleabihf
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-linux-arm-gnueabihf
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-darwin-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-darwin-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-android-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@rollup\rollup-android-arm-eabi
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-win32-ia32
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-wasm32
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@emnapi\runtime
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-linuxmusl-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-linuxmusl-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-linux-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-linux-s390x
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-linux-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-linux-arm
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-libvips-linuxmusl-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-libvips-linuxmusl-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-libvips-linux-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-libvips-linux-s390x
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-libvips-linux-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-libvips-linux-arm
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-libvips-darwin-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-libvips-darwin-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-darwin-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@img\sharp-darwin-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\win32-ia32
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\win32-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\sunos-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\openbsd-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\netbsd-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\linux-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\linux-s390x
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\linux-riscv64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\linux-ppc64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\linux-mips64el
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\linux-loong64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\linux-ia32
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\linux-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\linux-arm
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\freebsd-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\freebsd-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\darwin-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\darwin-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\android-x64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\android-arm64
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\android-arm
npm verb reify failed optional dependency D:\projects\electron-desktop\node_modules\@esbuild\aix-ppc64
npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 796ms
npm http fetch GET 200 https://registry.npmjs.org/cross-spawn 904ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/express 944ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/cookie 1000ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/serve-static 1006ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/path-to-regexp 1093ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/micromatch 1116ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/nanoid 1163ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/rollup 1226ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/vite 1256ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/send 1410ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/body-parser 2197ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/execa 156ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/yarn-or-npm 790ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/foreground-child 250ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/eslint 311ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/@malept%2fcross-spawn-promise 550ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/express-ws 956ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/@electron-forge%2fweb-multi-logger 2147ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/fast-glob 600ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/tailwindcss 1475ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/postcss 1009ms (cache updated)

up to date, audited 1109 packages in 11s

191 packages are looking for funding
  run `npm fund` for details

11 vulnerabilities (3 low, 3 moderate, 5 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
npm verb exit 0
npm info ok

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

  System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
    Memory: 18.71 GB / 31.95 GB
  Binaries:
    Node: 21.0.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.0 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    sharp: ^0.33.5 => 0.33.5
@lovell
Copy link
Owner

lovell commented Dec 19, 2024

I use electron-forge to package it.

For electron-forge please see https://github.com/lovell/sharp/blob/hat/docs/install.md#electron-forge

(These docs were recently updated and will be published with the next release.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants