"balena env add" does not accept service variables?

Perhaps I’m doing something wrong, but I was reading the documentation here and saw that it was possible to add service variables, though I get the following error when attempting to do so

matthew@thinkpad ~ $ balena env add OCTOPRINT_APIKEY 82F64792280242B89E63D2DFDF5C115E --device 338d9c2 --service octodash
Unexpected arguments: --service, octodash
See more help with --help

Additional information may be available by setting a DEBUG=1 environment
variable: "set DEBUG=1" on a Windows command prompt, or "export DEBUG=1"
on Linux or macOS.

If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io

For CLI bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/

When doing balena help env add the documentation in the CLI contradicts the aforementioned documentation. Has it ever been possible to do this?

matthew@thinkpad ~ $ balena help env add
Add an environment or config variable to an application or device.

USAGE
  $ balena env add NAME [VALUE]

ARGUMENTS
  NAME   environment or config variable name
  VALUE  variable value; if omitted, use value from CLI's environment

OPTIONS
  -a, --application=application  application name
  -d, --device=device            device UUID
  -h, --help                     show CLI help
  -q, --quiet                    suppress warning messages

DESCRIPTION
  Add an environment or config variable to an application or device, as selected
  by the respective command-line options.

  If VALUE is omitted, the CLI will attempt to use the value of the environment
  variable of same name in the CLI process' environment. In this case, a warning
  message will be printed. Use `--quiet` to suppress it.

  Service-specific variables are not currently supported. The given command line
  examples variables that apply to all services in an app or device.

EXAMPLES
  $ balena env add TERM --application MyApp
  $ balena env add EDITOR vim --application MyApp
  $ balena env add EDITOR vim --device 7cf02a6

Hi, is it possible that you are using an older balena cli? I just tried it on 11.25.17 and in that version the --service options is present. Latest version is 12.1.11 so maybe you could just use the latest version?

That will probably be it, my version is really quite old (11.18.2) what is the official method of upgrading via NPM? I followed the following docs to install it via NPM. https://github.com/balena-io/balena-cli/blob/master/INSTALL.md

When you run the cli, it should print in the beginning what is the command to run in order to update

It used to do that, but at some point stopped. My guess is that there is an issue with npm that has prevented this from showing up in subsequent versions.

Try npm install balena-cli -g

This was only possible after sudo npm uninstall -g balena-cli which produced the following output

matthew@thinkpad ~ $ sudo npm uninstall -g balena-cli

> husky@4.2.5 preuninstall /usr/lib/node_modules/balena-cli/node_modules/husky
> node husky uninstall

husky > Uninstalling git hooks
Can't find package.json in /home/matthew directory or parents
Please check that your project has a package.json or create one and reinstall husky.
husky > Failed to uninstall

It would otherwise tell me that balena-cli was present in the filesystem, which is confusing since NPM supposedly managed this package. Either way, I have it sorted out now. I think a better way to handle package management would be nix, since it would solve distro specific problems. I’ll endeavor to demonstrate this in the future.

Yeah, that’s why I use the standalone version of the cli