xseman / bysquare

Encode & Decode "PAY by square" QR string.
https://xseman.github.io/bysquare/
Apache License 2.0
26 stars 4 forks source link

Last version breaking app #8

Closed Hanrider8 closed 1 year ago

Hanrider8 commented 1 year ago

Hello, I used previously lib without issues and generating of QRs was perfect, but since update of version I am getting this error from lib after generate() function.

Here is code(image because code block is not formated properly don't know why):

image

Console:

image
xseman commented 1 year ago

Hello @Hanrider8 thanks for reporting the issue. Please provide output of npx envinfo --binaries --system

Hanrider8 commented 1 year ago

here: image

xseman commented 1 year ago

Thanks, for future issues please use text block instead of images to make search indexing easier.

It looks like it has something to do with the compression library used in project on the ARM M1 architecture.\ Related issiue https://github.com/addaleax/lzma-native/issues/127

Can you please clone the project, downgrade package to "lzma-native": "7.0.1" and run npm test on your M1 laptop? Thanks!

Hanrider8 commented 1 year ago

I am using images because code blocks have wrong formating somehow.

Hanrider8 commented 1 year ago

soo here is my terminal. When I cloned and run npm install without dependency change tests passed.

MacBook-Pro:bysquare sevjakub$ npm install

added 48 packages, and audited 49 packages in 3s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
MacBook-Pro:bysquare sevjakub$ npm run test

> bysquare@1.3.3 test
> vitest

 RUN  v0.24.3 /Users/sevjakub/dev/own/bysquare

 ✓ src/generate.test.ts (7)
 ✓ src/parse.test.ts (4)

Test Files  2 passed (2)
     Tests  11 passed (11)
  Start at  22:11:12
  Duration  2.18s (transform 701ms, setup 0ms, collect 303ms, tests 62ms)`

But when I changed dependency to 7.0.1 I got errors even from npm install. Here:

npm ERR! code 1
npm ERR! path /Users/sevjakub/dev/own/bysquare/node_modules/lzma-native
npm ERR! command failed
npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build && rimraf build
npm ERR! Failed to execute '/Users/sevjakub/.nvm/versions/node/v18.8.0/bin/node /Users/sevjakub/.nvm/versions/node/v18.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/sevjakub/dev/own/bysquare/node_modules/lzma-native/binding-v7.0.1-n-api-darwin-x64/lzma_native.node --module_name=lzma_native --module_path=/Users/sevjakub/dev/own/bysquare/node_modules/lzma-native/binding-v7.0.1-n-api-darwin-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
npm ERR! node-pre-gyp info using node@18.8.0 | darwin | x64
npm ERR! node-pre-gyp info check checked for "/Users/sevjakub/dev/own/bysquare/node_modules/lzma-native/binding-v7.0.1-n-api-darwin-x64/lzma_native.node" (not found)
npm ERR! node-pre-gyp http GET https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v7.0.1-n-api-darwin-x64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v7.0.1-n-api-darwin-x64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for lzma-native@7.0.1 and node@18.8.0 (node-v108 ABI, unknown) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v7.0.1-n-api-darwin-x64.tar.gz 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@18.8.0 | darwin | x64
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@18.8.0 | darwin | x64
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack     at PythonFinder.fail (/Users/sevjakub/.nvm/versions/node/v18.8.0/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/Users/sevjakub/.nvm/versions/node/v18.8.0/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/Users/sevjakub/.nvm/versions/node/v18.8.0/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/Users/sevjakub/.nvm/versions/node/v18.8.0/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
npm ERR! gyp ERR! stack     at exithandler (node:child_process:420:5)
npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:432:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:289:12)
npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:476:16)
npm ERR! gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR! gyp ERR! System Darwin 21.6.0
npm ERR! gyp ERR! command "/Users/sevjakub/.nvm/versions/node/v18.8.0/bin/node" "/Users/sevjakub/.nvm/versions/node/v18.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/sevjakub/dev/own/bysquare/node_modules/lzma-native/binding-v7.0.1-n-api-darwin-x64/lzma_native.node" "--module_name=lzma_native" "--module_path=/Users/sevjakub/dev/own/bysquare/node_modules/lzma-native/binding-v7.0.1-n-api-darwin-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
npm ERR! gyp ERR! cwd /Users/sevjakub/dev/own/bysquare/node_modules/lzma-native
npm ERR! gyp ERR! node -v v18.8.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/Users/sevjakub/.nvm/versions/node/v18.8.0/bin/node /Users/sevjakub/.nvm/versions/node/v18.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/sevjakub/dev/own/bysquare/node_modules/lzma-native/binding-v7.0.1-n-api-darwin-x64/lzma_native.node --module_name=lzma_native --module_path=/Users/sevjakub/dev/own/bysquare/node_modules/lzma-native/binding-v7.0.1-n-api-darwin-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/sevjakub/dev/own/bysquare/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.6.0
npm ERR! node-pre-gyp ERR! command "/Users/sevjakub/.nvm/versions/node/v18.8.0/bin/node" "/Users/sevjakub/dev/own/bysquare/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/sevjakub/dev/own/bysquare/node_modules/lzma-native
npm ERR! node-pre-gyp ERR! node -v v18.8.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sevjakub/.npm/_logs/2022-10-24T20_12_20_342Z-debug-0.log

I do not use and have python so maybe something with that.

xseman commented 1 year ago

This is hard to debug without a reproducible environment. My colleague did the same test on his M1, he got the same error as you, downgrading the package fixed the error.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

Glogo commented 1 year ago

Was experiencing the same error message on M1 mac and was unable to find this thread due to the image. So I'm pasting the error message here for future reference:

dyld[1074]: missing symbol called

Since the mentioned fix from develop is not yet published (current npm version is 1.3.2) you have to override the dependency manually (for now)

Besides building the lib yourself you have option to use "overrides" if you are using npm or "resolutions" for yarn

Example:

package.json

{
  "name": "bysquare-test",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "type": "module",
  "dependencies": {
    "bysquare": "^1.3.3"
  },
  "overrides": {
    "lzma-native": "7.0.1"
  },
  "resolutions": {
    "lzma-native": "7.0.1"
  }
}

index.js

import { generate, PaymentOptions } from 'bysquare';

(async () => {
    console.log(await generate({
        InvoiceID: "random-id",
        IBAN: "SK9611000000002918599669",
        Amount: 100.0,
        CurrencyCode: "EUR",
        VariableSymbol: "123",
        Payments: 1,
        PaymentOptions: PaymentOptions.PaymentOrder,
        BankAccounts: 1
    }))
})()
node index.js

(edit) Also note that if you are using yarn workspace (like me) you have to put "resolutions" into root package.json, cheers

xseman commented 1 year ago

@Glogo thanks for the reminder, I completely forgot to do a new release, now v1.3.4 is published with the dependency version downgraded, it should fix M1/2 for now.

I am not completely satisfied with this solution, the author of the library has not yet responded to this problem since January.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

xseman commented 1 year ago

Starting from v2.1.0, there is no more dependency binding, which means that any architecture is now supported.