Brooooooklyn / canvas

High performance skia binding to Node.js. Zero system dependencies and pure npm packages without any postinstall scripts nor node-gyp.
https://vercel.skia.rs
MIT License
1.78k stars 76 forks source link

Can't deploy on Vercel #724

Open Autometrique opened 1 year ago

Autometrique commented 1 year ago

@napi-rs/canvas breaks my deployment on Vercel

It's working fine on local.

"@napi-rs/canvas": "^0.1.44" "next": "^13.4.19", npm version: 10.1.0 screencapture

I have all the optional dependencies :

"node_modules/@napi-rs/canvas": {
      "version": "0.1.44",
      "resolved": "https://registry.npmjs.org/@napi-rs/canvas/-/canvas-0.1.44.tgz",
      "integrity": "sha512-IyhSndjw29LR1WqkUZvTJI4j8Ve1QGbZYtpdQjJjcFvsvJS4/WHzOWV8ZciLPJBhrYvSQf/JbZJy5LHmFV+plg==",
      "engines": {
        "node": ">= 10"
      },
      "optionalDependencies": {
        "@napi-rs/canvas-android-arm64": "0.1.44",
        "@napi-rs/canvas-darwin-arm64": "0.1.44",
        "@napi-rs/canvas-darwin-x64": "0.1.44",
        "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.44",
        "@napi-rs/canvas-linux-arm64-gnu": "0.1.44",
        "@napi-rs/canvas-linux-arm64-musl": "0.1.44",
        "@napi-rs/canvas-linux-x64-gnu": "0.1.44",
        "@napi-rs/canvas-linux-x64-musl": "0.1.44",
        "@napi-rs/canvas-win32-x64-msvc": "0.1.44"
      }
    },
Autometrique commented 1 year ago

I finally managed to make it work by adding the module to the experimental "serverComponentsExternalPackages" in the next.config.js. Hope it will help others

experimental: {
        serverComponentsExternalPackages: ['@napi-rs/canvas']
      },
k-tten commented 10 months ago

Is this on the Hobby plan? When I use it on Vercel, it never installs any of the optional dependencies. Does it work correctly if the optional dependencies are not installed?