cli : randomly get Error: ENOENT: no such file or directory, lstat '/opt/lib'

$ balena devices

sometimes works

$ balena devices

sometimes gives an error

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: ENOENT: no such file or directory, lstat '/opt/lib'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at Object.realpathSync (fs.js:1461:7)
    at Object.fs.realpathSync (pkg/prelude/bootstrap.js:822:36)
    at Object.<anonymous> (/snapshot/versioned-source/node_modules/is-installed-globally/index.js:8:29)
    at Module._compile (pkg/prelude/bootstrap.js:1266:22)

Hi @osde8info

Thank you for your query! To help us get to the bottom of this, can you please let us know which versions of balenaOS and balena-cli you are using, as well as how you installed balena-cli?

Thank you

2.31 2.46 2.47 2.48

$ balena -v

i cant remember how i installed but i think NPM install failed so i used ZIP install

Thanks for the info @osde8info . Just another question - what is the operating system on the computer where you’re using balena-cli?

controller OS is xubuntu 18

@osde8info, this issue should be fixed in CLI version 11.31.3 and later:

The root cause is in an upstream dependency and there is one remaining occurrence of the affected dependency in the CLI, but the most common occurrences (as in your error report) should be fixed in CLI 11.31.3. I am trying to get the remaining occurrence resolved by working with upstream maintainers:

Thank you for reporting it!

1 Like