samizdatco / skia-canvas

A GPU-accelerated 2D graphics environment for Node.js
MIT License
1.7k stars 66 forks source link

Can't resolve './v6' #103

Closed xinfang closed 2 years ago

xinfang commented 2 years ago

I meet this issue. any advice is appreciate

Thanks.


ERROR in ./node_modules/skia-canvas/lib/index.js23:28-43
Module not found: Error: Can't resolve './v6' in '/home/runner/work/test/test/node_modules/skia-canvas/lib'
resolve './v6' in '/home/runner/work/test/test/node_modules/skia-canvas/lib'
  using description file: /home/runner/work/test/test/node_modules/skia-canvas/package.json (relative path: ./lib)
    using description file: /home/runner/work/test/test/node_modules/skia-canvas/package.json (relative path: ./lib/v6)
      no extension
        /home/runner/work/test/test/node_modules/skia-canvas/lib/v6 is not a file
      .js
        /home/runner/work/test/test/node_modules/skia-canvas/lib/v6.js doesn't exist
      .json
        /home/runner/work/test/test/node_modules/skia-canvas/lib/v6.json doesn't exist
      .wasm
        /home/runner/work/test/test/node_modules/skia-canvas/lib/v6.wasm doesn't exist
      as directory
        existing directory /home/runner/work/test/test/node_modules/skia-canvas/lib/v6
          using description file: /home/runner/work/test/test/node_modules/skia-canvas/package.json (relative path: ./lib/v6)
            using path: /home/runner/work/test/test/node_modules/skia-canvas/lib/v6/index
              using description file: /home/runner/work/test/test/node_modules/skia-canvas/package.json (relative path: ./lib/v6/index)
                no extension
                  /home/runner/work/test/test/node_modules/skia-canvas/lib/v6/index doesn't exist
                .js
                  /home/runner/work/test/test/node_modules/skia-canvas/lib/v6/index.js doesn't exist
                .json
                  /home/runner/work/test/test/node_modules/skia-canvas/lib/v6/index.json doesn't exist
                .wasm
                  /home/runner/work/test/test/node_modules/skia-canvas/lib/v6/index.wasm doesn't exist
samizdatco commented 2 years ago

The lib/v6 directory is where the compiled rust library is supposed to be found. It looks like something went wrong when you initially installed the module. Take a look at the Installation section of the readme and make sure your system meets all the requirements and you followed the correct procedure for installing the module.

giancarlo88 commented 1 year ago

For anyone else coming across this issue, ensure that in your webpack config you have skia-canvas listed under the externals property:

module.exports = {
  // ...(other webpack config)
  externals: { 
    // ...
    'skia-canvas': 'skia-canvas'
  }
}

The issue stems from webpack trying to build with the skia-canvas package as if it's all JS when it actually contains a binary.

andyslack commented 1 year ago

Hi Guys,

I am getting this error on a backend NestJS application when I run my Jest tests.

Any idea how I can overcome this?

 FAIL  src/modules/qrcodes/qrcode.controller.test.spec.ts
  ● Test suite failed to run

    Cannot find module './v6' from 'node_modules/skia-canvas/lib/index.js'

    Require stack:
      node_modules/skia-canvas/lib/index.js