balena-io / balena-cli

The official balena CLI tool.
Apache License 2.0
455 stars 143 forks source link

"No native build was found" when using standalone zip package #2763

Open theepicflyer opened 6 months ago

theepicflyer commented 6 months ago

Expected Behavior

With the Windows standalone version (balena-cli-v18.2.2-windows-x64-standalone), I expected to download the folder, unzip it, and run the balena.exe inside for the balena local flash and balena util available-drives functions. I do not have Nodejs installed and do not expect that to be necessary to run this standalone.

Actual Behavior

The following error comes up when running either of the above commands. It seems to be looking for the usb module in C:\snapshot\balena-cli\node_modules\usb, a directory I do not have. The usb module is included in the standalone zip but the code is nevertheless trying to find it in C:\snapshot\balena-cli\node_modules\usb instead.

C:\Users\[user]\Downloads\balena-cli-v18.2.2-windows-x64-standalone\balena-cli>balena util available-drives --debug
[debug] new argv=[C:\Users\[user]\Downloads\balena-cli-v18.2.2-windows-x64-standalone\balena-cli\balena.exe,C:\snapshot\balena-cli\bin\run.js,util:available-drives] length=3
[debug] Deprecation check: 0.70261 days since last npm registry query for next major version release date.
[debug] Will not query the registry again until at least 7 days have passed.
No native build was found for platform=win32 arch=x64 runtime=node abi=115 uv=1 libc=glibc node=20.10.0
    loaded from: C:\snapshot\balena-cli\node_modules\usb

Error: No native build was found for platform=win32 arch=x64 runtime=node abi=115 uv=1 libc=glibc node=20.10.0
    loaded from: C:\snapshot\balena-cli\node_modules\usb

    at Function.<anonymous> (C:\snapshot\balena-cli\node_modules\node-gyp-build\node-gyp-build.js:60:9)
    at load (C:\snapshot\balena-cli\node_modules\node-gyp-build\node-gyp-build.js:22:30)
    at Object.<anonymous> (C:\snapshot\balena-cli\node_modules\usb\dist\usb\bindings.js:8:36)
    at Module._compile (pkg/prelude/bootstrap.js:1930:22)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31)
    at require (node:internal/modules/helpers:176:18)

For further help or support, visit:
https://www.balena.io/docs/reference/balena-cli/#support-faq-and-troubleshooting

[debug] Event tracking error: Timeout awaiting 'response' for 0ms

Additional References

However, if the installer is used instead, there is no error and the two commands work fine. I also found a post on the Balena forums with the same issue. The user then says version 14 standalone does not have this issue and I have verified that v14.5.2 works fine (balena-cli-v14.5.2-windows-x64-standalone).

Steps to Reproduce the Problem

  1. Have no Nodejs installed.
  2. Download balena-cli-v18.2.2-windows-x64-standalone
  3. Run balena util available-drives or balena local flash with an image

Specifications

otaviojacobi commented 4 months ago

For anyone investigating this, latest build that actually works as expected on windows standalone is v15.2.3 which means it broke on https://github.com/balena-io/balena-cli/pull/2618