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

Update your sharp dependandy to run the application in windows #53

Open
Iran-110 opened this issue Oct 17, 2024 · 1 comment
Open

Update your sharp dependandy to run the application in windows #53

Iran-110 opened this issue Oct 17, 2024 · 1 comment

Comments

@Iran-110
Copy link

Iran-110 commented Oct 17, 2024

I'm using windows @vite-pwa/assets-generator: ^0.2.6 and get this error with yarn dev.

Error: Could not load the "sharp" module using the win32-x64 runtime
ERR_DLOPEN_FAILED: The specified procedure could not be found.
\\?\X:\paht_to_the_project\node_modules\@img\sharp-win32-x64\lib\sharp-win32-x64.node
Possible solutions:
- Ensure optional dependencies can be installed:
    npm install --include=optional sharp
- Ensure your package manager supports multi-platform installation:
    See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
    npm install --os=win32 --cpu=x64 sharp
- Using the canvas package on Windows?
    See https://sharp.pixelplumbing.com/install#canvas-and-windows
- Check for outdated versions of sharp in the dependency tree:
    npm ls sharp
- Consult the installation documentation:

It comes from yarn installing two different versions of sharp in yarn.lock (^0.33.5 is the latest and ^0.32.6 is your dependency). Here is the yarn.lock:

sharp@*:
  version "0.33.5"
  resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.33.5.tgz#13e0e4130cc309d6a9497596715240b2ec0c594e"
  integrity sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==
  dependencies:
    color "^4.2.3"
    detect-libc "^2.0.3"
    semver "^7.6.3"
  optionalDependencies:
    "@img/sharp-darwin-arm64" "0.33.5"
    "@img/sharp-darwin-x64" "0.33.5"
    "@img/sharp-libvips-darwin-arm64" "1.0.4"
    "@img/sharp-libvips-darwin-x64" "1.0.4"
    "@img/sharp-libvips-linux-arm" "1.0.5"
    "@img/sharp-libvips-linux-arm64" "1.0.4"
    "@img/sharp-libvips-linux-s390x" "1.0.4"
    "@img/sharp-libvips-linux-x64" "1.0.4"
    "@img/sharp-libvips-linuxmusl-arm64" "1.0.4"
    "@img/sharp-libvips-linuxmusl-x64" "1.0.4"
    "@img/sharp-linux-arm" "0.33.5"
    "@img/sharp-linux-arm64" "0.33.5"
    "@img/sharp-linux-s390x" "0.33.5"
    "@img/sharp-linux-x64" "0.33.5"
    "@img/sharp-linuxmusl-arm64" "0.33.5"
    "@img/sharp-linuxmusl-x64" "0.33.5"
    "@img/sharp-wasm32" "0.33.5"
    "@img/sharp-win32-ia32" "0.33.5"
    "@img/sharp-win32-x64" "0.33.5"

sharp@^0.32.6:
  version "0.32.6"
  resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.32.6.tgz#6ad30c0b7cd910df65d5f355f774aa4fce45732a"
  integrity sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w==
  dependencies:
    color "^4.2.3"
    detect-libc "^2.0.2"
    node-addon-api "^6.1.0"
    prebuild-install "^7.1.1"
    semver "^7.5.4"
    simple-get "^4.0.1"
    tar-fs "^3.0.4"
    tunnel-agent "^0.6.0"

I was looking for a solution and after an hour I found this solution: lovell/sharp#3878 (comment)

It resolves the issue by adding these lines to package.json:

{
  "resolution": {
    "sharp": "^0.33.5"
  }
}
@wanghaisheng
Copy link

lovell/sharp#4291
@userquin can you help and verify

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

No branches or pull requests

2 participants