node-gfx / node-canvas-prebuilt

Repo used to build binaries for node-canvas on CI
169 stars 31 forks source link

Add node-v48-win32-ia32? #27

Open DonKarlssonSan opened 6 years ago

DonKarlssonSan commented 6 years ago

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

zbjornson commented 6 years ago

(Sorta off-topic: Is it easy for you to see the output of process.arch and require("os").arch() with a 64-bit function? Curious if that's a bug in Azure's deployment or in node-pre-gyp's detection.)

DonKarlssonSan commented 6 years ago

Aha! Conflicting info. Azure Functions seems to be the one to blame for reporting x86 to node-pre-gyp

D:\home>node test.js
ia32 ia32

D:\home>node --version
v6.5.0

D:\home>cat test.js
console.log(process.arch, require("os").arch());

System info

System up time: 1.21:10:02 OS version: Microsoft Windows NT 6.2.9200.0 64 bit system: True 64 bit process: True

Environment variables

REMOTEDEBUGGINGBITVERSION = vx64 REMOTEDEBUGGINGPORT = REMOTEDEBUGGINGVERSION = 11.0.611103.400 SCM_SKIP_SSL_VALIDATION = 0 SCM_USE_FUNCPACK = 0 ScmType = GitHub SITE_BITNESS = AMD64

chearon commented 6 years ago

If it's an option for you, you can pass --target_arch=x64 to npm install and that should override node-pre-gyp's choice. I probably won't get around to adding 32 bit support seeing as I still haven't done ARM and that has been a popular request 😕

DonKarlssonSan commented 6 years ago

Thanks! I will try that.

rand0me commented 6 years ago
  1. Switching Azure Function to x64 can't help because:
    $ node -p "process.arch"
    > ia32
  2. --target_arch=x64 can't help too, because Node.js process arch is ia32 (i.e. they install x32 Node.js version on a x64 machine)
  3. Some people says, that we can try Azure Functions on Linux to achieve this, but in my case it didn't help, because it has Node.js 6.11 :grin:

So, as for now, no way to install and use node-canvas on Azure Function App