Inherited npm_config_ environment variables can break npx command
If Antora is run using npx, then it will populate npm_config_ environment variables. These environment variables are inherited by the run command. In certain cases, these environment variables can interfere with the operation of npx when used as the run command. For example, the following command will fail: ``` npx -y @jti/vale -v ``` However, it works if the long form is used: ``` npm -y --package @jti/vale vale -v ``` The reason the shorthand form breaks seems to be a conflict with the npm_config_package environment variable. Though, it's import to note that the npm_config_yes environment variable is also inherited, which changes the default behavior of npx. Collector should either remove the npm_config_ environment variables, or it should at least remove the npm_config_package and npm_config_yes environment variables. (It can perhaps do this if npm_command=exec or npm_lifecycle_event=npx). The only real benefit to keeping them is that the environment variables may be configuring the npm cache (npm_config_cache), so perhaps only keep that one, or only if the command starts with $NPM or $NPX (indicating we want to inherit the environment). As a workaround, these environment variables can be cleared using the env key on the run entry. ``` env: - name: npm_config_package value: ~ - name: npm_config_yes value: ~ ``` However, doing so makes the abstraction leaky.
issue