Nvm: Junk in $NVM_DIR

Created on 27 Oct 2017  路  8Comments  路  Source: nvm-sh/nvm

  • Operating system and version:
    macOS Sierra 10.12.6
  • nvm debug output:

nvm --version: v0.33.6
$TERM_PROGRAM: Apple_Terminal
$SHELL: /bin/bash
$HOME: /Users/thomas
$NVM_DIR: '$HOME/.nvm
Saving session...
...copying shared history...
...saving history...
...completed.'
sed: 1: "s#/Users/thomas/.nvm
Sa ...": unterminated substitute pattern
$PREFIX: ''
sed: 1: "s#/Users/thomas/.nvm
Sa ...": unterminated substitute pattern
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)'
uname -a: 'Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64'
OS version: Mac 10.12.6 16G29
curl: /usr/bin/curl, curl 7.54.0 (x86_64-apple-darwin16.0) libcurl/7.54.0 SecureTransport zlib/1.2.8
wget: /usr/local/bin/wget, GNU Wget 1.18 built on darwin16.0.0.
git: /usr/local/bin/git, git version 2.11.0
grep: /usr/bin/grep, grep (BSD grep) 2.5.1-FreeBSD
awk: /usr/bin/awk, awk version 20070501
sed: illegal option -- -
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
sed: /usr/bin/sed, 
cut: illegal option -- -
usage: cut -b list [-n] [file ...]
       cut -c list [file ...]
       cut -f list [-s] [-d delim] [file ...]
cut: /usr/bin/cut, 
basename: illegal option -- -
usage: basename string [suffix]
       basename [-a] [-s suffix] string [...]
basename: /usr/bin/basename, 
rm: illegal option -- -
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file
rm: /bin/rm, 
mkdir: illegal option -- -
usage: mkdir [-pv] [-m mode] directory ...
mkdir: /bin/mkdir, 
xargs: illegal option -- -
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
             [-L number] [-n number [-x]] [-P maxprocs] [-s size]
             [utility [argument ...]]
xargs: /usr/bin/xargs, 
sed: 1: "s#/Users/thomas/.nvm
Sa ...": unterminated substitute pattern
nvm current: 
sed: 1: "s#/Users/thomas/.nvm
Sa ...": unterminated substitute pattern
which node: 
sed: 1: "s#/Users/thomas/.nvm
Sa ...": unterminated substitute pattern
which iojs: 
sed: 1: "s#/Users/thomas/.nvm
Sa ...": unterminated substitute pattern
which npm: 
sed: 1: "s#/Users/thomas/.nvm
Sa ...": unterminated substitute pattern
npm config get prefix: 
sed: 1: "s#/Users/thomas/.nvm
Sa ...": unterminated substitute pattern
npm root -g: 

  • nvm ls output:

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)

  • How did you install nvm? (e.g. install script in readme, homebrew):
    Install script in readme. Also deleted ~/.nvm and tried to reinstall. Problem persists.
  • What steps did you perform?
    Can't remember, just began today. (Maybe macOS upgrade?)
  • What happened?
    $NVM_DIR variable is broken, when I reset it back to $HOME/.nvm, nvm works. But it resets on every restart of terminal, although the additional junk can nowhere be found in the .bashrc or .profile file.
  • What did you expect to happen?
    nvm works as usual.

Thanks in advance :-)

Mac OS non-issue / invalid bassh

Most helpful comment

I fixed it. I think the solution was more along the lines of #1183 and #1083.
There was some old nvm stuff in my ~/.profile that I didn't see before, because it was right under the rvm configuration...

I removed it and then discovered that my ~/.bashrc, where the actual nvm loading takes place, isn't even loaded to my interactive sessions, so that I now added sourcing the ~/.bashrc in my ~/.bash_profile. Now everything works as expected 馃帀

Thanks for the helpful links that convinced me to check the config files once again!

All 8 comments

All that "Saving session...
...copying shared history...
...saving history...
...completed.'" output is concerning; similarly, what does which sed print out?

which sed outputs just normal: /usr/bin/sed

This

Saving session... ...copying shared history... ...saving history... ...completed.

seems to come from a relatively new feature of saving the bash session state.
See https://apple.stackexchange.com/questions/214862/strange-output-at-end-of-terminal-session-in-os-x-el-capitan

Remains the question: how did it get into my NVM_DIR and how do I get it out of there? 馃槄

https://github.com/creationix/nvm/issues/1183#issuecomment-236501456 and https://github.com/creationix/nvm/issues/1083#issuecomment-217765583 may be related; can you read through those and see if any of the suggestions apply to you?

Okay, when I disable bash sessions, as described here https://stackoverflow.com/questions/32418438/how-can-i-disable-bash-sessions-in-os-x-el-capitan/34803825#34803825 (by creating a ~/.bash_sessions_disable file), nvm works just fine.
Getting closer... 馃槈

If nvm can figure out how to disable that output for individual commands, then there's a workaround I can employ.

I fixed it. I think the solution was more along the lines of #1183 and #1083.
There was some old nvm stuff in my ~/.profile that I didn't see before, because it was right under the rvm configuration...

I removed it and then discovered that my ~/.bashrc, where the actual nvm loading takes place, isn't even loaded to my interactive sessions, so that I now added sourcing the ~/.bashrc in my ~/.bash_profile. Now everything works as expected 馃帀

Thanks for the helpful links that convinced me to check the config files once again!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

swateek picture swateek  路  3Comments

nickngqs picture nickngqs  路  3Comments

ksmithut picture ksmithut  路  3Comments

goalidea picture goalidea  路  3Comments

dtgriscom picture dtgriscom  路  4Comments