kyranet / canvas-constructor

An ES6 utility for canvas with built-in functions and chained methods.
https://canvasconstructor.js.org
MIT License
116 stars 23 forks source link

bug: No "exports" main defined #414

Closed Rox0z closed 2 years ago

Rox0z commented 2 years ago

Describe the bug

Canvas-constructor cannot run in any code. Feeling the reason is incompatibility with Apple Silicon. Tested with this code

const canvas = require('canvas-constructor/skia');
const fs = require('fs');
(async ()=>{
    const image = await canvas(400, 400)
    .toBuffer()
    fs.writeFileSync('output.png', image)
})()

but it can't even run, showing this error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in ~/workspace/node_modules/canvas-constructor/package.json

To Reproduce

  1. install Canvas or Skia-Canvas
  2. Try this code above
  3. See if it's run

Expected behavior

Code runs and create a blank .png file on workspace

Screenshots

Screen Shot 2021-11-02 at 11 28 33

Additional context

Trying to running his on my MacBook with Apple Silicon M1

Rox0z commented 2 years ago

The problem was me, using old code of canvas-constructor, didn't notice the /skia in the README file, its working perfectly.