Giter Club home page Giter Club logo

node-canvas-prebuilt's Introduction

NOTE: the canvas-prebuilt package is deprecated. As of version 2, canvas itself bundles prebuilt versions from this repo. Install by running

npm install --save canvas

…and use canvas as usual.

Using canvas-prebuilt (deprecated)

This is a drop-in replacement for canvas that does not require any compiling. The repo is just a set of scripts that downloads a specific node-canvas version, builds it and bundles it on all platforms. It's meant to run on Travis and AppVeyor but it can be run locally too.

If you still need to use prebuilt 1.x and 2-alpha versions of canvas, run npm install --save canvas-prebuilt or replace canvas with canvas-prebuilt in your dependencies.

In your code, use require('canvas-prebuilt') wherever you would otherwise use require('canvas').

Linux technicalities

Linux users will need glibc >= 2.13.1 (Ubuntu 14.04+, Debian 7+, etc)

If you are using fonts, you might see some FontConfig warnings which are harmless:

Situation Message Meaning
You have an old version of FontConfig on your system Fontconfig warning: line 142: blank doesn't take any effect anymore. please remove it from your fonts.conf You don't need to do anything, but removing said line or upgrading FontConfig on your system should fix it
You don't have FontConfig Fontconfig error: Cannot load default config file You don't have any fonts on your system, so if you want to use the text APIs you'll either need to install FontConfig or use Canvas.registerFont

Releases

See the releases page on GitHub to check if your OS, architecture, and node are supported. Currently we're focused on x64 for Windows, Mac and Linux for most recent Node versions.

Bundling

The bundling scripts just take a regularly compiled executable (canvas.node in this case) and look at which non-system libraries it links against. Those libraries are then copied to the release directory and binaries are updated if necessary to refer to them.

The strategies for bundling could be applied to other projects too since they're general:

  • On macOS, macpack is used to search dependencies, filter out non-system ones, and update binary references
  • On Windows, Dependency Walker's CLI is used to search dependencies. Anything in the MSYS2 folder is considered non-system. Patching is not necessary because Windows looks for dlls in the same folder as the binary
  • On Linux, pax-utils searches dependencies, and everything not in /lib is non-system. The custom binding.gyp compiles canvas.node to look inside its own directory for dependencies

node-canvas-prebuilt's People

Contributors

alexeckermann avatar chearon avatar delucis avatar henrycatalinismith avatar khrome83 avatar molant avatar ugzuzg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-canvas-prebuilt's Issues

Release missing - causes NPM install errors

We recently started getting the following error:

`2018-05-03T20:13:31.5325710Z node-pre-gyp http GET https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.5-prerelease.1/canvas-prebuilt-v1.6.5-prerelease.1-node-v57-win32-x64.tar.gz

2018-05-03T20:13:33.4241042Z node-pre-gyp http 404 https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.5-prerelease.1/canvas-prebuilt-v1.6.5-prerelease.1-node-v57-win32-x64.tar.gz

2018-05-03T20:13:33.4241042Z node-pre-gyp ERR! install error

2018-05-03T20:13:33.4397203Z node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.5-prerelease.1/canvas-prebuilt-v1.6.5-prerelease.1-node-v57-win32-x64.tar.gz`

Was this release removed? Why are we getting a 404 now?

1.6.12 not released

The mentioned version is not being released on npm but the binaries are existing for it.

404 when requesting "arm" build from Raspberry Pi

Hi there !
I tried to npm install on Raspbian, but the build cannot be found.

node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.5-prerelease.1/canvas-prebuilt-v1.6.5-prerelease.1-node-v48-linux-arm.tar.gz

Looking at the list of available tarballs, I cannot find the requested -node-v48-linux-arm.tar.gz indeed.
Is it possible to get "arm" versions of these ?

Procedure not found

node --version
v8.12.0

windows x64

I get the following error. Using it in firebase functions. The same code runs on osx.

  • functions: Finished running predeploy script.
    i functions: ensuring necessary APIs are enabled...
  • functions: all necessary APIs are enabled
    i functions: preparing functions directory for uploading...

Error: Error occurred while parsing your function triggers.

Error: The specified procedure could not be found.
\?\C:\Users\Arif\Documents\GitHub\digibaad-functions\functions\node_modules\canvas-prebuilt\canvas\build\Release\canvas.node
at Object.Module._extensions..node (module.js:682:18)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\Arif\Documents\GitHub\digibaad-functions\functions\node_modules\canvas-prebuilt\canvas\lib\bindings.js:3:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: firebase deploy --only functions
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Arif\AppData\Roaming\npm-cache_logs\2018-10-06T11_26_20_352Z-debug.log
PS C:\Users\Arif\Documents\GitHub\digibaad-functions\functions>

libpng12.so.0 is missing on Debian Linux 9

When I switch from canvasto canvas-prebuilt then my program crashes on Debian Linux 9 with the following error message:

Error: libpng12.so.0: cannot open shared object file: No such file or directory

I guess the problem ist, that you are creating the linux bundle on a Debian 8 system (or some linux which has the same problem). In Debian 8 for whatever reason libpng is installed in /lib/ instead of /usr/lib. I don't think that this library can be considered to be a "system" library and it definitely should be included in your bundle. Maybe you could add an exception so everything in /lib is excluded except libpng? I manually copied the library from a Debian 8 system to the canvas directory and everything worked fine.

On Debian 9 there is no libpng12.so.0 any longer, instead there is a libpng16.so.16 now which is correctly located in /usr/lib. So maybe another solution would be switching your CI system to Debian 9.

Canvas-prebuilt causes errors in webpack

I'm building a plugin for Kibana that uses Vega library. Kibana dynamically compiles all of the client-side code using webpack on the server side, before sending it to the browser. Recently, Vega added canvas-prebuilt dependency, and I cannot upgrade to it because now webpack in the build process throws this error.

Node 6.11.3, on Ubuntu 17.04

    ERROR in .-vega-vis/~/canvas-prebuilt/canvas/lib/bindings.js
    Module not found: Error: Cannot resolve 'file' or 'directory' ../build/Release/canvas in /home/yurik/dev/elastic/kibana-vega-vis/node_modules/canvas-prebuilt/canvas/lib
     @ .-vega-vis/~/canvas-prebuilt/canvas/lib/bindings.js 3:17-51

    at Object.exports.create (/home/yurik/dev/elastic/kibana/node_modules/boom/lib/index.js:21:17)
    at LazyOptimizer.failedStatsToError (/home/yurik/dev/elastic/kibana/src/optimize/base_optimizer.js:224:17)
    at Compiler.<anonymous> (/home/yurik/dev/elastic/kibana/src/optimize/lazy/lazy_optimizer.js:42:24)
    at Compiler.applyPlugins (/home/yurik/dev/elastic/kibana/node_modules/tapable/lib/Tapable.js:26:37)
    at Watching._done (/home/yurik/dev/elastic/kibana/node_modules/webpack/lib/Compiler.js:78:17)
    at Watching.<anonymous> (/home/yurik/dev/elastic/kibana/node_modules/webpack/lib/Compiler.js:51:17)
    at /home/yurik/dev/elastic/kibana/node_modules/webpack/lib/Compiler.js:403:12
    at Compiler.next (/home/yurik/dev/elastic/kibana/node_modules/tapable/lib/Tapable.js:67:11)
    at Compiler.<anonymous> (/home/yurik/dev/elastic/kibana/node_modules/webpack/lib/CachePlugin.js:40:4)
    at Compiler.applyPluginsAsync (/home/yurik/dev/elastic/kibana/node_modules/tapable/lib/Tapable.js:71:13)
    at Compiler.<anonymous> (/home/yurik/dev/elastic/kibana/node_modules/webpack/lib/Compiler.js:400:9)
    at Compilation.<anonymous> (/home/yurik/dev/elastic/kibana/node_modules/webpack/lib/Compilation.js:577:13)
    at Compilation.applyPluginsAsync (/home/yurik/dev/elastic/kibana/node_modules/tapable/lib/Tapable.js:60:69)
    at Compilation.<anonymous> (/home/yurik/dev/elastic/kibana/node_modules/webpack/lib/Compilation.js:572:10)
    at Compilation.applyPluginsAsync (/home/yurik/dev/elastic/kibana/node_modules/tapable/lib/Tapable.js:60:69)
    at Compilation.<anonymous> (/home/yurik/dev/elastic/kibana/node_modules/webpack/lib/Compilation.js:567:9)

Use macpack instead of macdylibbundler

I made macpack so I might as well start using it instead of macdylibbundler. It'll speed up the build a bit and I have more confidence in its ability to resolve dependencies effectively

A question ... import Canvas from "canvas-prebuilt" ... Canvas is null...

import Canvas from 'canvas-prebuilt';


const qrFor = (textToEncode: String,tempFile:any):Promise<String> => {

  const canvas =  new Canvas(500, 500);
  return new Promise((resolve,reject)=>{
    // const ctx = canvas.getContext('2d');
    QrCode.toFile(tempFile,textToEncode,
      {
        color: {
          dark: '#00F',  // Blue dots
          light: '#0000' // Transparent background
        }
      },
      (err) => {
        if(err){
          reject();

        }
        else{
          // const out = fs.createWriteStream(tempFile);
          // const stream = canvas.createJPEGStream();
          // stream.pipe(out);
          // out.on('finish', () =>  {
          //   console.log("saved temp qr");
          //   resolve();
          // });
          resolve();
        }




      });


  });

Here is my code and I am getting this error ... Please help

canvas_prebuilt_1.default is not a function
    at qrFor (/user_code/lib/qr/generate_qr.js:15:45)
    at Object.genrateProductQr [as default] (/user_code/lib/qr/generate_qr.js:56:12)
    at exports.helloWorld.functions.https.onRequest (/user_code/lib/index.js:31:33)
    at cloudFunction (/user_code/node_modules/firebase-functions/lib/providers/https.js:37:41)
    at /var/tmp/worker/worker.js:684:7
    at /var/tmp/worker/worker.js:668:9
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

Incorrect path to main, should be index.js?

"main": "./canvas/lib/canvas.js",

Using the latest 2.0.0-alpha.5, the main is pointing to ./canvas/lib/canvas.js which doesn't make any of what is described in ./canvas/index.js available — such as registerFont and Image.

I'm not a day-to-day node user so I am interested to know if this is intentional? In basic debugging locally, changing the reference of main to point to the index file I got access to everything I was expecting to.

Amazon linux cannot render text

I have an Linux AWS EC2 instance imaged with "Amazon Linux AMI 2017.03.0.20170417 x86_64 HVM GP2". I am trying to generate avatars with letters based on initials.

My code:

const Canvas = require('canvas-prebuilt');
...
const canvas = new Canvas(size, size);
const ctx = canvas.getContext('2d');

ctx.fillStyle = colours[colourIndex - 1];
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.font = Math.round(canvas.width / 2) + "px Arial";                                                                                                                                                                                                                                                                   
ctx.textAlign = "center";                                                                                                                                                                                                                                                                                               
ctx.fillStyle = "#FF0000";                                                                                                                                                                                                                                                                                              
ctx.fillText(initials, size / 2, size / 1.5);     
...

On my OSX, it renders the image correctly. However, on the ec2-instance, it draws the background correctly, the the letters show up as unrecognized characters (□□) in small font.

No errors at all during npm install or when running my code. What could be missing?

Warning: /lib64/libc.so.6: version `GLIBC_2.14' not found

At my company we are using node-canvas-prebuilt@~2.0.0-alpha.2 to build PNG sprite images. Everything works fine.

Suddenly, on some machines, yarn is reinstalling node-canvas-prebuilt even when dependencies remain unchanged. Don't know why - it's another question.

yarn downloads canvas-prebuilt-v2.0.0-alpha.2-node-v57-linux-x64. This is a correct behavior. But after installation build script is failing with error.

Warning: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./node_modules/canvas-prebuilt/canvas/build/Release/canvas.node) Use --force to continue.
# Absolute path was ommited.

I made a backup of correct canvas.node and we are replacing wrong one when issue occurs. After replacement everything works as usual without errors.
Re-installation of node_modules and yarn cache clean doesn't help.

It seems like canvas.node in that tarball was changed after release. At instance, file size differs from the previous one. I don't know if that possible, but this is my only assumption.

  File: './canvas-correct.node'
  Size: 276110    	Blocks: 552        IO Block: 4096   regular file
Device: fc00h/64512d	Inode: 2547939     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/    ilya)   Gid: ( 1000/    ilya)
Access: 2018-06-13 15:06:32.979344840 +0300
Modify: 2017-11-04 21:46:12.000000000 +0200
Change: 2018-06-06 13:01:30.943530902 +0300
 Birth: -
  File: './canvas-wrong.node'
  Size: 273568    	Blocks: 536        IO Block: 4096   regular file
Device: fc00h/64512d	Inode: 2548115     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/    ilya)   Gid: ( 1000/    ilya)
Access: 2018-06-13 15:17:57.862660000 +0300
Modify: 2018-05-02 18:02:22.000000000 +0300
Change: 2018-06-13 15:18:00.810626362 +0300
 Birth: -

Versions of Node, npm and yarn are the same on every development machine.
Node.js version: v8.11.2
yarn version: 1.3.2
npm version: 5.6.0

OS and libc versions are the same too: CentOS 6.9 and GNU libc v2.12.

To summarize, I have two questions:

  1. Why canvas.node was changed in archive file of June 2017 release?
  2. How to tell yarn to not to re-install installed binary (probably, this question should be asked somewhere else).

data-uri break the process with no error

When you run this code, the process break without any error.

const datauri = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
const Canvas = require('canvas-prebuilt');

const image = new Canvas.Image();

image.onerror = function (e) {
    console.log(e);
}
console.log('before');
image.src = datauri;
console.log('after');

Expected output:

before
Error: error while reading from input stream
after

Current output:

before

If I change to canvas everything works as expected (any 1.6.x version).

It works with version 2.0.0-alpha.13 but I can't use it because it is use in jsdom and they don't support version 2 yet.

Maybe this will be fixed after #51 is done.

Support for node 9.0?

Is there any major blockers (other than time) to add support for node 9.0 now that's published?

Works on Windows, doesn't work on Linux

Test on a component which is using vue-chartjs (which is based on canvas) runs fine on Windows, but fails to run on Linux machine:

Step 8/10 : RUN yarn test:unit
---> Running in 7ecc871d2a00
yarn run v1.3.2
$ vue-cli-service test:unit
Using API URL: http://localhost
console.error node_modules/jsdom/lib/jsdom/virtual-console.js:29
Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
at module.exports (/app/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
at HTMLCanvasElementImpl.getContext (/app/node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js:42:5)
at HTMLCanvasElement.getContext (/app/node_modules/jsdom/lib/jsdom/living/generated/HTMLCanvasElement.js:50:45)
at VueComponent.renderChart (/app/node_modules/vue-chartjs/dist/webpack:/src/BaseCharts.js:68:29)
at VueComponent.mounted (/app/src/components/ui/ChartLine.vue:96:1)
at callHook (/app/node_modules/vue/dist/vue.runtime.common.js:2919:21)
at mountComponent (/app/node_modules/vue/dist/vue.runtime.common.js:2800:5)
at VueComponent.Object..Vue.$mount (/app/node_modules/vue/dist/vue.runtime.common.js:7997:10)
at mount (/app/node_modules/@vue/test-utils/dist/vue-test-utils.js:4659:8)
at shallow (/app/node_modules/@vue/test-utils/dist/vue-test-utils.js:4691:10) undefined

There were no errors/warnings during installation. It also fails with canvas-prebuilt v. 2.0.0-alpha.12.

Dependencies from package.json:

"dependencies": {
    "@vue/cli-plugin-babel": "^3.0.0-rc.5",
    "@vue/cli-plugin-e2e-cypress": "^3.0.0-rc.5",
    "@vue/cli-plugin-eslint": "^3.0.0-rc.5",
    "@vue/cli-plugin-unit-jest": "^3.0.0-rc.5",
    "@vue/cli-service": "^3.0.0-rc.5",
    "@vue/eslint-config-prettier": "^3.0.0-rc.5",
    "@vue/server-test-utils": "^1.0.0-beta.20",
    "@vue/test-utils": "1.0.0-beta.12",
    "axios": "^0.18.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "^23.2.0",
    "bootstrap": "4.1.0",
    "bootstrap-vue": "^2.0.0-rc.11",
    "canvas-prebuilt": "1.6.5-prerelease.1",
    "chart.js": "^2.7.2",
    "element-ui": "^2.4.3",
    "eslint-plugin-jest": "^21.17.0",
    "eslint-plugin-vue": "^4.7.0",
    "flat": "^4.0.0",
    "jest-canvas-mock": "^1.1.0",
    "lint-staged": "^7.2.0",
    "lodash": "^4.17.10",
    "moment": "^2.22.2",
    "moment-locales-webpack-plugin": "^1.0.7",
    "node-sass": "^4.9.0",
    "query-string": "^5.1.1",
    "sass-loader": "^7.0.3",
    "sinon": "^6.1.0",
    "svg-sprite-loader": "^3.9.0",
    "svgo": "^1.0.5",
    "svgo-loader": "^2.1.0",
    "vee-validate": "^2.0.9",
    "vue": "^2.5.16",
    "vue-chartjs": "^3.3.2",
    "vue-clipboard2": "^0.1.1",
    "vue-date": "^1.1.10",
    "vue-peity": "^0.5.0",
    "vue-router": "^3.0.1",
    "vue-toasted": "^1.1.24",
    "vue-upload-component": "^2.8.9",
    "vuebar": "^0.0.18",
    "vuex": "^3.0.1",
    "vuex-router-sync": "^5.0.0"
  },

issue: Cannot install any canvas builds on newer nodejs versions

Hello.

Right now, on Windows at least, I'm unable to install the latest prebuilt version due to a 404 error.

I'm running node.js 10 with npm 6. This issue also occurred with node 9, using npm i node-gfx/node-canvas-prebuilt.

Anything I can do past building node-canvas manually?

Thanks!

Font features not working in the Linux builds

See #5

Travis is using a Ubuntu that is so old (12.04) that it uses Pango "modules" (dynamically loaded shared libraries that do shaping for different languages). Either I distribute those with prebuilt, or I use a newer Ubuntu via Docker. Newer distributions of Ubuntu don't use these shared libraries and seem to bundle them into the main Pango instead.

The Docker approach seems like the best one

Can't install the package globally on macOS and WSL

Trying to run sudo npm install -g canvas-prebuilt fails with the following output:

> [email protected] install /usr/lib/node_modules/canvas-prebuilt
> node-pre-gyp install

node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/canvas-prebuilt/canvas/build'
node-pre-gyp ERR! System Linux 4.4.0-43-Microsoft
node-pre-gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/canvas-prebuilt/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /usr/lib/node_modules/canvas-prebuilt
node-pre-gyp ERR! node -v v8.1.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
EACCES: permission denied, mkdir '/usr/lib/node_modules/canvas-prebuilt/canvas/build'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Repros on:

Running node 8.1.2 and npm 5.0.3.

Here is the log file. Not sure what is going on :(

breaks gl package.

Works:

require('gl');
require('canvas-prebuilt');
require('gl')(800, 600, { preserveDrawingBuffer: true })

Doesn't work:

require('canvas-prebuilt');
require('gl')(800, 600, { preserveDrawingBuffer: true })

canvas-prebuilt: 1.6.0
gl: 4.0.04
Ubuntu 16.04
X.Org 1.16.4 using the dummy driver

Alpine Linux fail / best distro for canvas-prebuilt

Many docker images are based on Alpine Linux because it's super light. I'm talking about node:alpine precisely.

I've installed canvas-prebuilt with version 1.6.5 and got missing libpng. Found issue and it suggested updating to 2.0.0-alpha.

Updating to 2.0.0-alpha fixed libpng issue, but finished with

Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /builds/soanvig/hptcg-game/node_modules/canvas-prebuilt/canvas/build/Release/libpixman-1.so.0)

(it's GitLab.com CI)

So I wonder - is there Alpine Linux fix or I can switch to any other distro, but I would like to know, which distro should I use for image base. There is no info anywhere which distro works best.

Crash on debugging

As soon as a breakpoint is set in the node.js process the native canvas module crashes with the following error:


Microsoft Visual C++ Runtime Library

Assertion failed!

Program: ...s\canvas-prebuilt\canvas\build\Release\canvas.node
File: c:\projects\node-canvas-prebuilt\no...\nan_obj..._wrap.h
Line: 33

Expression: object->InternalFieldCount() > 0

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application - JIT must be enabled)

Abort Retry Ignore

Running latest via npm install and npm rebuild
node version 8.5.0
on Windows 10 Pro 64bit

pango support

Hello Chearon,

Would you be so kind to explain in some way what is the difference of node canvas when is built with pango support or not, if pango is complementar to cairo or is on top of it, or in place of it and how this affect text rendering?

I have lot of confusion around this when people open node related question on fabricjs issue tracker.

Is a prebuilt version with pango available?

Can't install 2.0.0 Alpha 12 on Ubuntu 17.10

Hi,
I try to install last version, 2.0.0 Alpha 12 and can't install on Ubuntu 17.10:
This is the error, package doesn't exist 404:

node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/chearon/node-canvas-prebuilt/releases/download/v2.0.0-alpha.12/canvas-prebuilt-v2.0.0-alpha.12-node-v59-linux-x64.tar.gz
node-pre-gyp ERR! stack at Request. (/home/javichaques/Development/Typescript/Inbounder/functions/node_modules/node-pre-gyp/lib/install.js:118:27)
node-pre-gyp ERR! stack at Request.emit (events.js:185:15)
node-pre-gyp ERR! stack at Request.onRequestResponse (/home/javichaques/Development/Typescript/Inbounder/functions/node_modules/node-pre-gyp/node_modules/request/request.js:1074:10)
node-pre-gyp ERR! stack at ClientRequest.emit (events.js:180:13)
node-pre-gyp ERR! stack at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:539:21)
node-pre-gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17)
node-pre-gyp ERR! stack at TLSSocket.socketOnData (_http_client.js:444:20)
node-pre-gyp ERR! stack at TLSSocket.emit (events.js:180:13)
node-pre-gyp ERR! stack at addChunk (_stream_readable.js:269:12)
node-pre-gyp ERR! stack at readableAddChunk (_stream_readable.js:256:11)
node-pre-gyp ERR! System Linux 4.13.0-38-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/javichaques/Development/Typescript/Inbounder/functions/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /home/javichaques/Development/Typescript/Inbounder/functions/node_modules/canvas-prebuilt
node-pre-gyp ERR! node -v v9.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
404 status code downloading tarball https://github.com/chearon/node-canvas-prebuilt/releases/download/v2.0.0-alpha.12/canvas-prebuilt-v2.0.0-alpha.12-node-v59-linux-x64.tar.gz
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/javichaques/.npm/_logs/2018-04-11T15_23_30_270Z-debug.log

Thank you

`npm i [email protected]` fail with 404

$ npm i [email protected]

> [email protected] install /home/zixia/git/node-facenet/node_modules/canvas
> node-pre-gyp install

node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.0.0-alpha.10/canvas-prebuilt-v2.0.0-alpha.10-node-v59-linux-x64.tar.gz
node-pre-gyp ERR! stack     at Request.<anonymous> (/home/zixia/git/node-facenet/node_modules/node-pre-gyp/lib/install.js:118:27)
node-pre-gyp ERR! stack     at Request.emit (events.js:132:15)
node-pre-gyp ERR! stack     at Request.onRequestResponse (/home/zixia/git/node-facenet/node_modules/node-pre-gyp/node_modules/request/request.js:1074:10)
node-pre-gyp ERR! stack     at ClientRequest.emit (events.js:127:13)
node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:539:21)
node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17)
node-pre-gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:444:20)
node-pre-gyp ERR! stack     at TLSSocket.emit (events.js:127:13)
node-pre-gyp ERR! stack     at addChunk (_stream_readable.js:269:12)
node-pre-gyp ERR! stack     at readableAddChunk (_stream_readable.js:256:11)
node-pre-gyp ERR! System Linux 4.13.0-36-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/zixia/git/node-facenet/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /home/zixia/git/node-facenet/node_modules/canvas
node-pre-gyp ERR! node -v v9.7.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
404 status code downloading tarball https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.0.0-alpha.10/canvas-prebuilt-v2.0.0-alpha.10-node-v59-linux-x64.tar.gz

Link to Automattic/node-canvas#1111

Update to 1.6.1 to enable `registerFont`

Hi there!

Thank you for creating such a wonderful module - it's opened up a lot of doors in infrastructure land being prebuilt.

node-canvas recently updated to 1.6.1 with a new method Canvas.registerFont which allows you to register 3rd-party font families to use within your Canvases.

Would it be possible to version bump? Happy to put in any work to contribute, just new to building bindings for different architectures.

Let me know how I can help!

Text render error on Firebase Functions

I am using node-canvas-prebuilt in Firebase Functions. I have an issue with rendering text, all characters are rendered as ☐
screen shot 2017-07-23 at 14 06 05

I thought it might be an issue with the installed font, but I see the same error when loading a bundled ttf file.

Version 1.6.0 is the latest one I can use, for later versions I get the libgobject-2.0.so.0: undefined symbol: g_option_group_unref compile time error I have seen here already mentioned in another issue.

Firebase functions are run inside these docker containers: https://github.com/GoogleCloudPlatform/nodejs-docker/blob/master/runtime-image/Dockerfile

Error on start after latest update

As of publishing, update was ~1hr ago, 1.6.15.

Error: Cannot find module 'parse-css-font'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/user_code/node_modules/canvas-prebuilt/canvas/lib/context2d.js:19:20)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/user_code/node_modules/canvas-prebuilt/canvas/lib/canvas.js:17:17)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)

node-pre-gyp intermittently fails on yarn install

Hello! Thanks for this great module.
I am seeing intermittent failures when yarn installing my application dependencies.

Here are the logs:

error An unexpected error occurred: "/<APP_DIR>/node_modules/canvas-prebuilt: Command failed.
Exit code: 1
Command: sh
Arguments: -c node_modules/.bin/node-pre-gyp install
Directory: /<APP_DIR>/node_modules/canvas-prebuilt
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/<APP_DIR>/node_modules/canvas-prebuilt/canvas/build/Release/canvas-prebuilt.node" (not found)
node-pre-gyp http GET https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.11/canvas-prebuilt-v1.6.11-node-v59-linux-x64.tar.gz
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: tunneling socket could not be established, statusCode=502
node-pre-gyp ERR! stack at ClientRequest.onConnect (/<APP_DIR>/node_modules/tunnel-agent/index.js:165:19)
node-pre-gyp ERR! stack at Object.onceWrapper (events.js:328:30)
node-pre-gyp ERR! stack at emitThree (events.js:145:13)
node-pre-gyp ERR! stack at ClientRequest.emit (events.js:227:7)
node-pre-gyp ERR! stack at Socket.socketOnData (_http_client.js:471:11)
node-pre-gyp ERR! stack at emitOne (events.js:125:13)
node-pre-gyp ERR! stack at Socket.emit (events.js:221:7)
node-pre-gyp ERR! stack at addChunk (_stream_readable.js:265:12)
node-pre-gyp ERR! stack at readableAddChunk (_stream_readable.js:252:11)
node-pre-gyp ERR! stack at Socket.Readable.push (_stream_readable.js:209:10)
node-pre-gyp ERR! System Linux 4.11.3-74_fbk19_4137_g80c4e13d593b
node-pre-gyp ERR! command "/<APP_DIR>/node-dist/bin/node" "/<APP_DIR>/node_modules/canvas-prebuilt/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /<APP_DIR>/node_modules/canvas-prebuilt
node-pre-gyp ERR! node -v v9.1.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
tunneling socket could not be established, statusCode=502".

It actually may be an issue with tunnel-agent? Let me know what you think and if I can provide any more debug info.

Thanks!

libgobject error on Ubuntu

I'm running into an issue loading canvas-prebuilt on our CI servers, which are running Ubuntu. They work fine for me on my local machine, so having some difficulty figuring out what to try next. When I require('canvas-prebuilt') I see the following error:

Error: /home/u4646/src/repo/synchroform/node_modules/canvas-prebuilt/canvas/build/Release/libgobject-2.0.so.0: undefined symbol: g_variant_dict_ref
    at Error (native)
    at Object.Module._extensions..node (module.js:597:18)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/u4646/src/repo/synchroform/node_modules/canvas-prebuilt/canvas/lib/bindings.js:3:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

Any idea what I'm missing here? I saw this issue and wasn't sure if they were related. Happy to provide more information if I can get some tips on what else might be helpful.

npm ci failed with missing node-pre-gyp

Step to reproduce:

> mkdir test-canvas-prebuilt
> cd test-canvas-prebuilt
> npm init
> npm install canvas-prebuilt
> npm ci

throws error:

npm WARN prepare removing existing node_modules/ before installation

> [email protected] install some-path/node_modules/canvas-prebuilt
> node_modules/.bin/node-pre-gyp install

sh: node_modules/.bin/node-pre-gyp: No such file or directory
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] install: `node_modules/.bin/node-pre-gyp install`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     some-path/.npm/_logs/2018-08-17T23_32_55_765Z-debug.log

From this, it seems like we need to list node-pre-gyp as bundledDependencies in package.json

node -v
10.3.0
npm -v
6.1.0

Run from electron

Good evening!

I wonder if it's possible to use this package from within electron?

I'm using electron 1.7.11 and canvas-prebuilt 1.6.5-prerelease.1, but when I attempt to do so, the following error is raised:

Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\\?\D:\Workspace\GitHub\_Scarlett\scarlett-editor\node_modules\canvas-prebuilt\canvas\build\Release\canvas.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (D:\Workspace\GitHub\_Scarlett\scarlett-editor\node_modules\canvas-prebuilt\canvas\lib\bindings.js:3:18)
    at Object.<anonymous> (D:\Workspace\GitHub\_Scarlett\scarlett-editor\node_modules\canvas-prebuilt\canvas\lib\bindings.js:5:3)

The output yielded from windows.process.version is v7.9.0.

Any ideas on how to build this package targeting electron?
I've read something about electron-rebuild. Could it be used somehow?

Thanks!

TypeError: Canvas.registerFont is not a function

I am using the latest [email protected]

I'm not quite sure why it's doing this, and I've tried uninstalling and reinstalling and using older versions, but it still returns the same error. Any thoughts?

Edit: If I remove the Canvas.registerFont(), it gives me another error:
TypeError: Image is not a constructor

Also, I console.log(Canvas) and it outputs:
{ [Function: Canvas] _registerFont: [Function: _registerFont] }

It doesn't have a Image constructor, but oddly enough the _registerFont works

UPDATE: Changed var Canvas = require('canvas-prebuilt'); to var Canvas = require('E:/path-to/canvas-prebuilt/canvas');. Works like a charm.

installation as fabric dependency

Hello, I'm Andrea, mantainer of fabric.js

Fabric rely on node-canvas for node operations and has normal canvas package as a dep.

Everyone complains that is a nightmare to install ( it is a nightmare on macosx and windows indeed )

I wanted to switch to this package to see if it would be better/faster for users to use fabric as a normal npm package.

I switched the dep and reinstalled.
Canvas installation is indeed instant and 0 logging.

I expected the replacement to work out of the box, but now the code cannot find the module canvas, that is named canvas-prebuilt.

Not a big deal since i recall it in a couple of lines, but before making the change i wanted to know if there is a way to have the module with the same name, or this thing would completely go against the npm logic?

Separate tags from target build version

This would unfortunately involve using something other than the native Travis/AppVeyor releases because they can't publish to arbitrary releases, it pretty much has to be based on the tag. So at the end of the build it would look at some environment variable like NODE_CANVAS_PREBUILT_TARGET which I would set in the Travis/AppVeyor web frontend.

That way, whenever a new node version comes out I can just add that version of node to the build, push the commit, and rebuild old versions one-by-one with the interface instead of pushing and deleting tags in a jenky way. It completely separates committing and tagging from building.

Tags are still needed for GitHub releases, though.

Support node 10

Hello all,

node 10.0.0 has been released and it would be great to have a version compatible with it. Hopefully this time there are less issues with npm.

Thanks a lot!

issue: Cannot require canvas-prebuilt due to missing files

Hello!

In my attempts at require-ing canvas-prebuilt I hit a roadblock, as it just throws an error. Looking through your package.json, you set main to ./canvas/index.js, but said file doesn't exist!

Seems like replacing it with ./canvas/build/Release/canvas.node fixed that.
Any long-term solutions?

Add node-v48-win32-ia32?

Hi,

I'm trying to use canvas-prebuilt on Azure Functions but there is an error during installation:

node-pre-gyp ERR! install error 
404 status code downloading tarball https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.5-prerelease.1/canvas-prebuilt-v1.6.5-prerelease.1-node-v48-win32-ia32.tar.gz
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.5-prerelease.1/canvas-prebuilt-v1.6.5-prerelease.1-node-v48-win32-ia32.tar.gz
node-pre-gyp ERR! stack     at Request.<anonymous> (D:\home\site\wwwroot\flowfieldimagetweetbot\node_modules\node-pre-gyp\lib\install.js:118:27)
node-pre-gyp ERR! stack     at emitOne (events.js:101:20)
node-pre-gyp ERR! stack     at Request.emit (events.js:188:7)
node-pre-gyp ERR! stack     at Request.onRequestResponse (D:\home\site\wwwroot\flowfieldimagetweetbot\node_modules\request\request.js:1074:10)
node-pre-gyp ERR! stack     at emitOne (events.js:96:13)
node-pre-gyp ERR! stack     at ClientRequest.emit (events.js:188:7)
node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:472:21)
node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:105:23)
node-pre-gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:361:20)
node-pre-gyp ERR! stack     at emitOne (events.js:96:13)
node-pre-gyp ERR! System Windows_NT 6.2.9200
node-pre-gyp ERR! command "D:\\Program Files (x86)\\nodejs\\6.5.0\\node.exe" "D:\\home\\site\\wwwroot\\flowfieldimagetweetbot\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install"
node-pre-gyp ERR! cwd D:\home\site\wwwroot\flowfieldimagetweetbot\node_modules\canvas-prebuilt
node-pre-gyp ERR! node -v v6.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 

It's looking for canvas-prebuilt-v1.6.5-prerelease.1-node-v48-win32-ia32.tar.gz but that does not exist so it fails. I saw this comment in the readme:

I have some ideas on how to get these working with cross-compilation if people request it. I plan to add Linux/ARM

So I'm wondering if it is possible to add Windows x86/ia32 builds as well? (node-v48-win32-ia32)

The node version in Azure Functions is currently locked at 6.5.0.

I've tried switching my Azure Function to 64 bit but that made no difference. Somehow the npm scripts detects the platform arch as 32.
image

Question about canvas-prebuilt

Hey @chearon, I have a question about this statement in the README:

This is a drop-in replacement for canvas that does not require any compiling.

So my question is, should the following work with canvas-prebuilt?

var canvas = require('canvas');

I ask, because I am experiencing different outcomes when using canvas and canvas-prebuilt. Examples below:

With canvas

$ docker run --rm -it node:6-onbuild /bin/bash
root@a8fdf92ddf9f:/usr/src/app# npm install [email protected]
...
root@a8fdf92ddf9f:/usr/src/app# node -e "var canvas = require('canvas');"
root@a8fdf92ddf9f:/usr/src/app# echo $?
0

With canvas-prebuilt

$ docker run --rm -it node:6-onbuild /bin/bash
root@43422ff3afb4:/usr/src/app# npm install [email protected]
...
root@43422ff3afb4:/usr/src/app# node -e "var canvas = require('canvas');"
module.js:471
    throw err;
    ^

Error: Cannot find module 'canvas'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at [eval]:1:14
    at ContextifyScript.Script.runInThisContext (vm.js:25:33)
    at Object.runInThisContext (vm.js:97:38)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:570:32)
    at Immediate.<anonymous> (bootstrap_node.js:358:29)
root@43422ff3afb4:/usr/src/app# echo $?
1

Thanks in advance.

Can't install on Linux machine

I am able to install this on my windows machine but can't install it on my Linux machine, my glibc is 2.17.

I am able to install all the packages except canvas-prebuilt. I am getting the following error.

npm install canvas-prebuilt

[email protected] install /export/local/gis/src/test/node_modules/canvas-prebuilt
node-pre-gyp install

node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND csc csc:80
node-pre-gyp ERR! stack at ClientRequest.onError (/export/local/gis/src/test/node_modules/tunnel-agent/index.js:177:17)
node-pre-gyp ERR! stack at Object.onceWrapper (events.js:315:30)
node-pre-gyp ERR! stack at emitOne (events.js:116:13)
node-pre-gyp ERR! stack at ClientRequest.emit (events.js:211:7)
node-pre-gyp ERR! stack at Socket.socketErrorListener (_http_client.js:387:9)
node-pre-gyp ERR! stack at emitOne (events.js:116:13)
node-pre-gyp ERR! stack at Socket.emit (events.js:211:7)
node-pre-gyp ERR! stack at emitErrorNT (internal/streams/destroy.js:64:8)
node-pre-gyp ERR! stack at _combinedTickCallback (internal/process/next_tick.js:138:11)
node-pre-gyp ERR! stack at process._tickCallback (internal/process/next_tick.js:180:9)
node-pre-gyp ERR! System Linux 3.10.0-693.2.2.el7.x86_64
node-pre-gyp ERR! command "/opt/rh/rh-nodejs8/root/usr/bin/node" "/export/local/gis/src/test/node_modules/canvas-prebuilt/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /export/local/gis/src/test/node_modules/canvas-prebuilt
node-pre-gyp ERR! node -v v8.9.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
tunneling socket could not be established, cause=getaddrinfo ENOTFOUND csc csc:80
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.