NielsLeenheer / ReceiptPrinterEncoder

Create a set of commands that can be send to any receipt printer that supports ESC/POS or StarPRNT
MIT License
141 stars 13 forks source link

enable to install on macos M1 #9

Closed mrbbp closed 1 day ago

mrbbp commented 2 months ago

npm install thermal-printer-encoder

npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE   package: 'node-png@0.4.3',
npm warn EBADENGINE   required: { node: '0.8.x' },
npm warn EBADENGINE   current: { node: 'v22.4.0', npm: '10.8.1' }
npm warn EBADENGINE }
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated npmlog@5.0.1: This package is no longer supported.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated are-we-there-yet@2.0.0: This package is no longer supported.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated gauge@3.0.2: This package is no longer supported.
npm error code 1
npm error path /Users/xxxxx/Sites/node_ticket/node_modules/canvas
npm error command failed
npm error command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm error SOLINK_MODULE(target) Release/canvas-postbuild.node
npm error   CXX(target) Release/obj.target/canvas/src/backend/Backend.o
npm error   CXX(target) Release/obj.target/canvas/src/backend/ImageBackend.o
npm error   CXX(target) Release/obj.target/canvas/src/backend/PdfBackend.o
npm error Failed to execute '/Users/xxxxx/.nvm/versions/node/v22.4.0/bin/node /Users/xxxxx/.nvm/versions/node/v22.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/Users/xxxxx/Sites/node_ticket/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/xxxxx/Sites/node_ticket/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
npm error node-pre-gyp info it worked if it ends with ok
npm error node-pre-gyp info using node-pre-gyp@1.0.11
npm error node-pre-gyp info using node@22.4.0 | darwin | arm64
npm error (node:84993) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-darwin-unknown-arm64.tar.gz
npm error node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-darwin-unknown-arm64.tar.gz 
npm error node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@22.4.0 (node-v127 ABI, unknown) (falling back to source compile with node-gyp) 
npm error node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-darwin-unknown-arm64.tar.gz 
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@10.1.0
npm error gyp info using node@22.4.0 | darwin | arm64
npm error gyp info ok 
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@10.1.0
npm error gyp info using node@22.4.0 | darwin | arm64
npm error gyp info find Python using Python version 3.12.3 found at "/usr/local/opt/python@3.12/bin/python3.12"
npm error gyp info spawn /usr/local/opt/python@3.12/bin/python3.12
npm error gyp info spawn args [
npm error gyp info spawn args '/Users/xxxxx/.nvm/versions/node/v22.4.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/xxxxx/Sites/node_ticket/node_modules/canvas/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/xxxxx/.nvm/versions/node/v22.4.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/xxxxx/Library/Caches/node-gyp/22.4.0/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/Users/xxxxx/Library/Caches/node-gyp/22.4.0',
npm error gyp info spawn args '-Dnode_gyp_dir=/Users/xxxxx/.nvm/versions/node/v22.4.0/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/Users/xxxxx/Library/Caches/node-gyp/22.4.0/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/Users/xxxxx/Sites/node_ticket/node_modules/canvas',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error Package 'gobject-2.0' requires 'libffi >= 3.0.0' but version of libffi is 2.1
npm error gyp info ok 
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@10.1.0
npm error gyp info using node@22.4.0 | darwin | arm64
npm error gyp info spawn make
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error In file included from ../src/backend/Backend.cc:1:
npm error ../src/backend/Backend.h:60:14: warning: private field 'backend' is not used [-Wunused-private-field]
npm error     Backend* backend;
npm error              ^
npm error 1 warning generated.
npm error In file included from ../src/backend/PdfBackend.cc:1:
npm error In file included from ../src/backend/PdfBackend.h:4:
npm error In file included from ../src/backend/../closure.h:5:
npm error ../src/backend/../Canvas.h:9:10: fatal error: 'pango/pangocairo.h' file not found
npm error #include <pango/pangocairo.h>
npm error          ^~~~~~~~~~~~~~~~~~~~
npm error 1 error generated.
npm error make: *** [Release/obj.target/canvas/src/backend/PdfBackend.o] Error 1
npm error gyp ERR! build error 
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/Users/xxxxx/.nvm/versions/node/v22.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm error gyp ERR! System Darwin 23.5.0
npm error gyp ERR! command "/Users/xxxxx/.nvm/versions/node/v22.4.0/bin/node" "/Users/xxxxx/.nvm/versions/node/v22.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--update-binary" "--module=/Users/xxxxx/Sites/node_ticket/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/xxxxx/Sites/node_ticket/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v127"
npm error gyp ERR! cwd /Users/xxxxx/Sites/node_ticket/node_modules/canvas
npm error gyp ERR! node -v v22.4.0
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok 
npm error node-pre-gyp ERR! build error 
npm error node-pre-gyp ERR! stack Error: Failed to execute '/Users/xxxxx/.nvm/versions/node/v22.4.0/bin/node /Users/xxxxx/.nvm/versions/node/v22.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/Users/xxxxx/Sites/node_ticket/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/xxxxx/Sites/node_ticket/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
npm error node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/xxxxx/Sites/node_ticket/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm error node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
npm error node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm error node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm error node-pre-gyp ERR! System Darwin 23.5.0
npm error node-pre-gyp ERR! command "/Users/xxxxx/.nvm/versions/node/v22.4.0/bin/node" "/Users/xxxxx/Sites/node_ticket/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm error node-pre-gyp ERR! cwd /Users/xxxxx/Sites/node_ticket/node_modules/canvas
npm error node-pre-gyp ERR! node -v v22.4.0
npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm error node-pre-gyp ERR! not ok
npm error A complete log of this run can be found in: /Users/xxxxx/.npm/_logs/2024-07-07T00_00_36_106Z-debug-0.log 
NielsLeenheer commented 2 months ago

It's an issue with node-canvas.

There is more info here:

https://github.com/Automattic/node-canvas/issues/1733

https://github.com/Automattic/node-canvas/issues/2353

NielsLeenheer commented 1 day ago

The upcoming version does not have a dependency on node-canvas anymore. So this should no longer be an issue.