Nvm: Unterminated substitute pattern

Created on 6 May 2016  路  10Comments  路  Source: nvm-sh/nvm

Hi,

Everything started with a npm not found.

Then I was trying to do nvm ls and got a sed error 'unterminated substitute pattern'.

I think that this might have started with a Command Line Tools update.

I've reinstalled nvm, and now I have the following trace:

Tomass-MBP-2:Temp Descargas tomascharad$ nvm ls
            N/A
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
node -> stable (-> N/A) (default)
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
iojs -> N/A (default)

Can someone please help?

I have rvm working properly...

Tomass-MBP-2:Temp Descargas tomascharad$ nvm --version
0.31.0

When trying to install a node version:

Tomass-MBP-2:Temp Descargas tomascharad$ nvm install v6.1.0
Downloading https://nodejs.org/dist/v6.1.0/node-v6.1.0-darwin-x64.tar.xz...
curl: Can't open '/Users/tomascharad/.nvm'!
curl: try 'curl --help' or 'curl --manual' for more information
curl: (6) Could not resolve host: Saving
curl: (6) Could not resolve host: session..
curl: (6) Could not resolve host: ...copying
curl: (6) Could not resolve host: shared
curl: (6) Could not resolve host: history..
curl: (6) Could not resolve host: ...saving
curl: (6) Could not resolve host: history..
curl: (6) Could not resolve host: ...completed
grep: /Users/tomascharad/.nvm
Saving session...
...copying shared history...
...saving history...
...completed./bin/node-v6.1.0-darwin-x64/node-v6.1.0-darwin-x64.tar.xz: No such file or directory
Binary download failed, trying source.
curl: Can't open '/Users/tomascharad/.nvm'!
curl: try 'curl --help' or 'curl --manual' for more information
curl: (6) Could not resolve host: Saving
curl: (6) Could not resolve host: session..
curl: (6) Could not resolve host: ...copying
curl: (6) Could not resolve host: shared
curl: (6) Could not resolve host: history..
curl: (6) Could not resolve host: ...saving
curl: (6) Could not resolve host: history..
curl: (6) Could not resolve host: ...completed
grep: /Users/tomascharad/.nvm
Saving session...
...copying shared history...
...saving history...
...completed./bin/node-v6.1.0-darwin-x64/node-v6.1.0-darwin-x64.tar.gz: No such file or directory
Binary download failed, trying source.
Detected that you have 4 CPU thread(s)
Set the number of jobs to 4 - 1 = 3 jobs to speed up the build
Installing node v1.0 and greater from source is not currently supported

I also have my system requirements on the App Store up to date.

non-issue / invalid

Most helpful comment

Hi @ljharb,

Many thanks.
I'm very sorry, but I guess that you are right. I've changed my bash_profile to:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

and now it seems to work perfectly.
Probably I was using the settings from an older documentation.
Many thanks again, and sorry for bothering you.

All 10 comments

@tomascharad thanks for the report! Could you try using nvm on the latest master (cd $NVM_DIR ; git fetch ; git checkout origin/master and restart your terminal) and see if the same problem occurs? I may have already fixed it.

If not, what does nvm debug print out?

Thanks very much @ljharb.
I just did, but the problem wasn't solved.
I copy below the requested information.

Tomass-MBP-2:~ tomascharad$ nvm ls
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
            N/A
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
node -> stable (-> N/A) (default)
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
iojs -> N/A (default)
Tomass-MBP-2:~ tomascharad$ nvm debug
nvm --version: v0.31.0
$SHELL: /bin/bash
$HOME: /Users/tomascharad
$NVM_DIR: '$HOME/.nvm
Saving session...
...copying shared history...
...saving history...
...completed.'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: none
which node: 
which iojs: 
which npm: 
npm config get prefix: -bash: npm: command not found
npm root -g: -bash: npm: command not found
Tomass-MBP-2:~ tomascharad$ 

What do nvm_ls (note the underscore) and nvm alias print out?

Tomass-MBP-2:cause_management tomascharad$ nvm_ls
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
N/A
Tomass-MBP-2:cause_management tomascharad$ nvm alias
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
node -> stable (-> N/A) (default)
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
sed: 2: "
            s#/Users/t ...": unterminated substitute pattern
iojs -> N/A (default)
Tomass-MBP-2:cause_management tomascharad$ 

Thanks, I'll see what I can come up with. Is your $HOME directory by any chance a symlink or hard link or mounted from another drive?

Mmm, not sure how to check that, but I have homebrew installed and I know that works with symlinks... how could I check that out?
I do not have a separate hard drive, I have a mac book pro retina 13'.
Anyway, maybe this helps:

Tomass-MBP-2:cause_management tomascharad$ $HOME
-bash: /Users/tomascharad: is a directory

This is my bash_profile if it helps:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

#THIS MUST BE AT THE END OF THE FILE FOR GVM TO WORK!!!
[[ -s "/Users/tomascharad/.gvm/bin/gvm-init.sh" ]] && source "/Users/tomascharad/.gvm/bin/gvm-init.sh"

# TCT: DART
export DART_EDITOR_DIR="/usr/local/opt/dart"

export DARTIUM_BIN="$DART_EDITOR_DIR/Chromium.app/Contents/MacOS/Chromium"

export DART_SDK="$DART_EDITOR_DIR/libexec"

PATH+=":$DART_SDK/bin"

#TCT: Virtualenvwrapper

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh

#TCT: RabbitMQ
export PATH=$PATH:/usr/local/sbin

#TCT: NVM
[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh  # This loads NVM

Must note that nvm ls-remote works fine, as well as nvm --help

@tomascharad what's echo $NVM_DIR print out? The nvm lines in your bash_profile aren't entirely correct - can you change them so they match the last lines of https://github.com/creationix/nvm#manual-install and try again?

Hi @ljharb,

Many thanks.
I'm very sorry, but I guess that you are right. I've changed my bash_profile to:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

and now it seems to work perfectly.
Probably I was using the settings from an older documentation.
Many thanks again, and sorry for bothering you.

no problem! glad we figured it out :-)

Was this page helpful?
0 / 5 - 0 ratings