0

I am trying to migrate my .bash_profile Bash configuration to Zsh. Thus I copied configuration to .zshrc file.

But I have two lines that fail to execute:

# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

I am getting the following error message when sourcing the file:

$ source .zshrc

N/A: version "N/A -> N/A" is not yet installed.

You need to run "nvm install N/A" to install it before using it.

I am new to zsh and cannot find how to solve that.

2
  • 3
    The error messages obviously does not come from Zsh, and the must occur from one of the files you are sourcing - most likely nvm.sh. BTW, it is pretty brave to source from Zsh a file which was obviously written for bash (bash_completion). I hope that you manually checked that all the files you are sourcing here indeed work for Zsh too and not only for bash. Commented Jan 2, 2021 at 9:23
  • you need to isolate the nvm files as the non working files. those files may just not work for zsh Commented Jan 6, 2021 at 13:42

1 Answer 1

1

You can't just source bash scripts with zsh, especially the completion script. I suggest looking at nvm's docs to see what to do for zsh. You can also take a look at "$NVM_DIR/nvm.sh" to see what it does, the only thing that matters usually is setting the PATH correctly. Skip the completion script entirely, those things just slow the shell.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.