nvm icon indicating copy to clipboard operation
nvm copied to clipboard

problem sed command (unterminated address regex) in nvm.sh

Open ygricks opened this issue 3 years ago • 2 comments

Operating system and version:

Linux my-pc 5.18.6-1-MANJARO #1 SMP PREEMPT_DYNAMIC Wed Jun 22 14:16:20 UTC 2022 x86_64 GNU/Linux

nvm ls output:

      v16.13.1
  ->      v18.3.0
           system
  default -> node (-> v18.3.0)
  iojs -> N/A (default)
  unstable -> N/A (default)
  node -> stable (-> v18.3.0) (default)
  stable -> 18.3 (-> v18.3.0) (default)
  lts/* -> lts/gallium (-> N/A)
  lts/argon -> v4.9.1 (-> N/A)
  lts/boron -> v6.17.1 (-> N/A)
  lts/carbon -> v8.17.0 (-> N/A)
  lts/dubnium -> v10.24.1 (-> N/A)
  lts/erbium -> v12.22.12 (-> N/A)
  lts/fermium -> v14.19.3 (-> N/A)
  lts/gallium -> v16.15.1 (-> N/A)

sh

sh-5.1$

How did you install nvm?

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

What happened?

I use your alias for command cd, so when I open directory with one of my project (.nvmrc [16.13.1/8.1.2]) it print in terminal the following:

sed: -e expression #1, char 230: unterminated address regex
v16.13.1 is already installed.
Now using node v16.13.1 (npm v8.1.2)

nvm

problem is in that sed: -e expression #1, char 230: unterminated address regex
I found that expression in end of the function nvm_ls from ~/.nvm/nvm.sh file, but I'm not so good with bash for fix that by myself so problem is in if statement (nvm v0.39.1) in line 1317 in file ~/.nvm/nvm.sh

ygricks avatar Jun 28 '22 08:06 ygricks

Please fill out the issue template in its entirety; it's there for a reason.

What exact cd code are you using?

ljharb avatar Jun 28 '22 16:06 ljharb

The regex here is perfectly valid, so it's possible your sed isn't posix-compliant (manjaro has this problem occasionally, iirc)

ljharb avatar Jun 28 '22 16:06 ljharb