Commit Graph

13 Commits (master)

Author SHA1 Message Date
Spike Grobstein 70aa611abc
[Fix] `nvm exec`: no longer error with '-q: invalid option' for zsh users
the `nvm.sh` file assigns and exports an `NVM_CD_FLAGS` variable if it
was sourced from a zsh shell. the fact that it's exported means that
it'll be assigned in all child processes, including the `nvm-exec`
script, which uses bash as the interpreter.

Bash's `cd` command doesn't have a `-q` flag, so if the `NVM_CD_FLAGS`
is assigned `-q`, the script will error out and incorrectly claim that
the node version isn't installed.

this also manifests itself in the `nvm exec` command.

Example:

```console
$ nvm exec 16.14.0 npm --version
Running node v16.14.0 (npm v8.3.1)
/Users/<ME>/.nvm/nvm.sh: line 28: cd: -q: invalid option
cd: usage: cd [-L|[-P [-e]] [-@]] [dir]
both the tree and the node path are required
N/A: version "v16.14.0 -> N/A" is not yet installed.

You need to run "nvm install v16.14.0" to install it before using it.
```

To address this, we unset the `NVM_CD_FLAGS` at the start of the
`nvm-exec` script, before loading `nvm.sh`.
2023-04-21 20:40:01 -07:00
Jordan Harband ad24e96fda
[shellcheck] disable additional `-x` warning from v0.7.2 2021-05-03 14:26:45 -07:00
Peter Dave Hello ac63638469
[Fix] add missing quotes for $NODE_VERSION in nvm-exec 2016-11-24 13:44:39 +08:00
Qiangjun Ran cadbbced20
[Tests] Replace all dots with backslash dots 2016-11-03 23:44:59 -07:00
Thomas Levine 0eaa7e0bde use env bash in nvm-exec and install.sh 2016-02-14 19:34:19 +00:00
Jordan Harband 77e0449c89 [Fix] `nvm-exec`: properly exit when failing; improve error messages, suppress `nvm use --help` output
Fixes #997.
2016-02-04 11:19:34 -08:00
Jordan Harband 4fcf37fa29 [New] support `--no-use` on sourcing, in supported shells.
Fixes #972.
2016-01-20 12:50:45 -08:00
Keiichiro Ui b76d43e9f8 Fix `nvm-exec` for the commands includes white-spaces 2015-12-24 19:48:35 +09:00
Jordan Harband d68f667464 When no arguments are passed to `nvm run X`, use `nvm exec` to open a REPL.
Fixes #625. Tests will be in #717.
2015-04-05 15:13:35 -07:00
Koen Punt b16bf303ca Suppress output of `nvm use`
+redirect errors to stdout
2014-06-18 08:54:14 +02:00
Jordan Harband 0871131dfd Make sure nvm-exec can use .nvmrc logic. Fixes #402, obviates #403. 2014-04-25 10:38:21 -07:00
Jordan Harband 3a21485050 Files should end in trailing newlines 2014-03-15 11:41:50 -07:00
Koen Punt f3d1770e3e nvm exec wrapper to execute commands with a specific node version 2014-03-15 15:58:32 +01:00