balena os cannot configure on self-hosted openbalena instance

I want to configure my device, which is Nvidia Jetson TX2, on my application,but after executing the command,

balena os configure ~/balena-cloud-jetson-tx2-2.47.0+rev2-dev-v10.6.27.img --app myApp

it shows the error,

[debug] new argv=[/usr/local/bin/node,/usr/local/bin/balena,os:configure,/home/darren/balena-cloud-jetson-tx2-2.47.0+rev2-dev-v10.6.27.img,–app,myApp] length=6
The module ‘/usr/local/lib/node_modules/balena-cli/node_modules/ext2fs/build/Release/bindings.node’
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).

Error: The module ‘/usr/local/lib/node_modules/balena-cli/node_modules/ext2fs/build/Release/bindings.node’
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
at Object.Module._extensions…node (internal/modules/cjs/loader.js:1187:18)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at bindings (/usr/local/lib/node_modules/balena-cli/node_modules/bindings/bindings.js:112:48)
at Object. (/usr/local/lib/node_modules/balena-cli/node_modules/ext2fs/lib/ext2fs.js:3:37)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (/usr/local/lib/node_modules/balena-cli/node_modules/ext2fs/index.js:2:18)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1157:10)

Additional information may be available with the --debug flag.
For help, visit our support forums: https://forums.balena.io
For bug reports or feature requests, see: Issues · balena-io/balena-cli · GitHub

Does anyone how to solve it?

Hi there, can you send us your balena-cli version, tell us how you installed the CLI, and the OS you are using? I’ll have a look if I can reproduce it.

The balena CLI version I am using is v12.9.1
The os is the Nvidia Jetson TX2 development version, and the version number is v10.6.27

Hi, I meant the OS on your own computer on which you are trying to configure the image.

I tried with the same balena-cli version and it works as expected. What is your local node version? Can you:

  1. Install a later node version (12-14)
  2. Try to install the latest balena cli (npm i -g --production balena-cli@12.9.7)

Try the command again and see if the same issue persists.

Hi, my device’s os is ubuntu v18.04.3, and the node version is v12.18.3.
And I used the command, npm install balena-cli -g --production --unsafe-perm, to install balena-cli before.
And I just tried to install the latest balena-cli, with

sudo npm i -g --production balena-cli@12.9.7

but it shows the error:

/usr/local/bin/balena → /usr/local/lib/node_modules/balena-cli/bin/balena

ref-napi@2.0.3 install /usr/local/lib/node_modules/balena-cli/node_modules/ref-napi
node-gyp-build

ffi-napi@3.0.1 install /usr/local/lib/node_modules/balena-cli/node_modules/ffi-napi
node-gyp-build

gyp WARN EACCES current user (“nobody”) does not have permission to access the dev dir “/home/darren/.cache/node-gyp/12.18.3”
gyp WARN EACCES attempting to reinstall using temporary dev dir “/usr/local/lib/node_modules/balena-cli/node_modules/ffi-napi/.node-gyp”
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/balena-cli/node_modules/ffi-napi/.node-gyp’
gyp ERR! System Linux 4.9.140-tegra
gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /usr/local/lib/node_modules/balena-cli/node_modules/ffi-napi
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

mountutils@1.3.19 install /usr/local/lib/node_modules/balena-cli/node_modules/mountutils
prebuild-install || node-gyp rebuild

prebuild-install WARN install EACCES: permission denied, access ‘/home/darren/.npm’
gyp WARN EACCES current user (“nobody”) does not have permission to access the dev dir “/home/darren/.cache/node-gyp/12.18.3”
gyp WARN EACCES attempting to reinstall using temporary dev dir “/usr/local/lib/node_modules/balena-cli/node_modules/mountutils/.node-gyp”
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/balena-cli/node_modules/mountutils/.node-gyp’
gyp ERR! System Linux 4.9.140-tegra
gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /usr/local/lib/node_modules/balena-cli/node_modules/mountutils
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/balena-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: winusb-driver-generator@1.2.4 (node_modules/balena-cli/node_modules/winusb-driver-generator):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for winusb-driver-generator@1.2.4: wanted {“os”:“win32”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: macmount@1.0.0 (node_modules/balena-cli/node_modules/macmount):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for macmount@1.0.0: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/balena-cli/node_modules/livepush/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ffi-napi@3.0.1 (node_modules/balena-cli/node_modules/ffi-napi):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ffi-napi@3.0.1 install: node-gyp-build
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mountutils@1.3.19 install: prebuild-install || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mountutils@1.3.19 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/darren/.npm/_logs/2020-07-30T13_53_43_717Z-debug.log

I’m not sure why this happens.
thank you!

Hi there,
Have you tried without doing sudo ?

When doing sudo npm install ROOT will create files in your npm cache, and following npm install or npm install -g will give you the this EACCES error that we see in your output.

Ideally npm should not be run with sudo, because it will create a local directory that can only be altered by the root user

let us know if this helps you!

Hi, I tried it without sudo
and it shows another error:

npm i -g --production balena-cli@12.9.7
/home/darren/.local/bin/balena → /home/darren/.local/lib/node_modules/balena-cli/bin/balena

ref-napi@2.0.3 install /home/darren/.local/lib/node_modules/balena-cli/node_modules/ref-napi
node-gyp-build

ffi-napi@3.0.1 install /home/darren/.local/lib/node_modules/balena-cli/node_modules/ffi-napi
node-gyp-build

make: Entering directory ‘/home/darren/.local/lib/node_modules/balena-cli/node_modules/ffi-napi/build’
CC(target) Release/obj.target/nothing/…/node-addon-api/src/nothing.o
cc: error: unrecognized command line option ‘-m64’
…/node-addon-api/src/nothing.target.mk:98: recipe for target ‘Release/obj.target/nothing/…/node-addon-api/src/nothing.o’ failed
make: *** [Release/obj.target/nothing/…/node-addon-api/src/nothing.o] Error 1
make: Leaving directory ‘/home/darren/.local/lib/node_modules/balena-cli/node_modules/ffi-napi/build’
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/darren/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.9.140-tegra
gyp ERR! command “/usr/local/bin/node” “/home/darren/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /home/darren/.local/lib/node_modules/balena-cli/node_modules/ffi-napi
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok

mountutils@1.3.19 install /home/darren/.local/lib/node_modules/balena-cli/node_modules/mountutils
prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=0.33.1 runtime=electron arch=x64 platform=linux)
make: Entering directory ‘/home/darren/.local/lib/node_modules/balena-cli/node_modules/mountutils/build’
CXX(target) Release/obj.target/MountUtils/src/mountutils.o
g++: error: unrecognized command line option ‘-m64’
MountUtils.target.mk:105: recipe for target ‘Release/obj.target/MountUtils/src/mountutils.o’ failed
make: *** [Release/obj.target/MountUtils/src/mountutils.o] Error 1
make: Leaving directory ‘/home/darren/.local/lib/node_modules/balena-cli/node_modules/mountutils/build’
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.9.140-tegra
gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /home/darren/.local/lib/node_modules/balena-cli/node_modules/mountutils
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/balena-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: winusb-driver-generator@1.2.4 (node_modules/balena-cli/node_modules/winusb-driver-generator):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for winusb-driver-generator@1.2.4: wanted {“os”:“win32”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: macmount@1.0.0 (node_modules/balena-cli/node_modules/macmount):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for macmount@1.0.0: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/balena-cli/node_modules/livepush/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ffi-napi@3.0.1 (node_modules/balena-cli/node_modules/ffi-napi):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ffi-napi@3.0.1 install: node-gyp-build
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mountutils@1.3.19 install: prebuild-install || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mountutils@1.3.19 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/darren/.npm/_logs/2020-07-30T16_22_59_186Z-debug.log

Hi there,

Ok, at least is not a permission ERROR now. Can you please try deleting package-lock.json and re run npm install also making sure that your packages versions are up-to-date could help (in your package.json)

Hope it works

Hi there,
Thanks for your helping, I found my balena-cli disappear (not sure what happen), and reinstalled the balena-cli with sudo npm install balena-cli -g --production --unsafe-perm, and the version is the latest, v12.9.9.
But I encounter another problem when I doing balena os configure:

balena os configure balena-cloud-jetson-tx2-2.47.0+rev2-dev-v10.6.27.img --app myApp
? Network Connection ethernet
Could not read OS version from the image. Please specify the balenaOS
version manually with the --version command-line option.
What’s argument should I add to execute this command successfully?

Hello,
You can try using the --version option and specifying the balenaOS version, for example 2.47.0+rev2. The documentation for OS configure (specifically the version option) is here: https://www.balena.io/docs/reference/balena-cli/#--version-version-2 - let us know if that helps. (You can also use balena os configure --help to see the help information)