balena cli error: could not find package.json

Suddenly out of nowhere balena cli stopped working…
Obviously i think the errors is someone related to it searching in /snapshot/, and not sure what package.json it is looking for… Everything worked fine until a couple minutes ago…
I did balena deploy, and balena preload, and from a different terminal i ran balena device …
Maybe somehow related to running balena process simulataneously from 2 different terminals…
I am unsure… Running linux ubuntu 22.04 on WSL

All balena CLI commands return basically the same error.

ben@BENCHRO-LT-IL:~/.config$ balena --version
could not find package.json with { isRoot: true, root: ‘/snapshot/balena-cli/bin’ }

Additional information may be available with the --debug flag.

For further help or support, visit:
balena CLI Documentation - Balena Documentation

┌───────────────────────────────────────────────────────┐
│ balena-cli update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /home/ben/.config │
└───────────────────────────────────────────────────────┘

With debug flag:

ben@BENCHRO-LT-IL:~/.config$ balena --version --debug
[debug] new argv=[/home/ben/balena/balena-cli/balena,/snapshot/balena-cli/bin/balena,version] length=3
could not find package.json with { isRoot: true, root: ‘/snapshot/balena-cli/bin’ }

Error: could not find package.json with { isRoot: true, root: ‘/snapshot/balena-cli/bin’ }
at Plugin.load (/snapshot/balena-cli/node_modules/@oclif/core/lib/config/plugin.js:136:19)
at async PluginLoader.loadRoot (/snapshot/balena-cli/node_modules/@oclif/core/lib/config/plugin-loader.js:63:13)
at async Config.load (/snapshot/balena-cli/node_modules/@oclif/core/lib/config/config.js:263:27)
at async Config.load (/snapshot/balena-cli/node_modules/@oclif/core/lib/config/config.js:153:9)
at async run (/snapshot/balena-cli/node_modules/@oclif/core/lib/main.js:49:20)
at async /snapshot/balena-cli/build/app.js:80:13
at async Promise.all (index 2)
at async oclifRun (/snapshot/balena-cli/build/app.js:98:5)
at async Object.run (/snapshot/balena-cli/build/app.js:111:9)
at async run (/snapshot/balena-cli/bin/balena:18:2)

For further help or support, visit:
balena CLI Documentation - Balena Documentation

┌───────────────────────────────────────────────────────┐
│ balena-cli update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /home/ben/.config │
└───────────────────────────────────────────────────────┘

I resolved the issue:

  1. deleted balena-cli folder, downloaded new version and installed.
  2. cleared up space on WSL

Note: WSL was out of space, so i cleared up some GBs.
The issue in my case was probably caused by WSL being out of space.

2 Likes