0

I am setting for MEAN stack on Mac Big Sur (M1) and I am unable to install packages due to zsh: command not found.

Here is what I have done so far. installed nvm (curl code from GitHub), nvm install node, ~/.nvm/nvm.sh. Tested with -v nvm and node -v, confirmed to be working. echo $0 $ZSH_VERSION shows -zsh 5.8 npm install -g @angular/cli got zsh: command not found: npm. Followed Command not found after npm install in zsh which recommended to add source /home/YOUUSERNAME/.bash_profile at the beginning of ~/.zshrc file.

To edit ~/.zshrc followed Editing the ~/.zshrc file
Did vim ~/.zshrc, in the first line of ~/.zshrc file, added source /home/Dickson_Local_AC/.bash_profile. Did ctrl + X to save, bottom of page showed -- INSERT --, closing terminal only gives terminate or cancel, chose terminate. The changes did not save, opening the file only shows ~/.zshrc" [New] at the bottom line.

Now npm, node -v show zsh: command not found. Reinstalled nvm, same problem.

What am I doing wrong? Can you lead me out of the stalemate and advice on how to install MEAN packages?

R. Richards
  • 24,603
  • 10
  • 64
  • 64
DMW
  • 1
  • 2
  • 2
    Don't just source `.bash_profile` from `.zshrc`; the two shells are not mutually compatible. You'll have to add the relevant parts of `.bash_profile` to `.zprofile`, adjusting the code as necessary to create valid `zsh` code. – chepner Jul 18 '21 at 12:54
  • Also, on Mac, I think your user home directories are normally under `/Users`, not `/home`, so if you did want to source your `.bash_profile` (and it's not clear to me why that would help) then it would be better to use `source ~/.bash_profile`. – John Bollinger Jul 18 '21 at 13:17
  • Note also that despite being a big fan of `vim`, I would be the first to admit that it is ... quirky. If it's available then you will find the GUI version (`gvim`) somewhat easier to use, but I would instead recommend the standard Mac `TextEdit` to most Mac users who don't already have a preferred editor. – John Bollinger Jul 18 '21 at 13:22
  • Thanks @chepner and @John Bollinger . I am very new to this and still trying to understand ```zsh``` and profile. What do I need to do to go past the zsh: command not found and be able to install say Angular – DMW Jul 18 '21 at 15:30
  • Your `.bash_profile` contains an assignment to `PATH` that adds the directory where `nvm` installs things. In `.zprofile`, you can add a line like `path+=( ... )`, where `...` is the appropriate directory. (I don't use Node, but I recall it's something like `~/.local/bin`. – chepner Jul 18 '21 at 17:49
  • @chepner I have bash and zsh files here ```Dickson_Local_AC@Air-Muoki /bin``` typed in```path+=Dickson_Local_AC@Air-Muoki /bin``` on the terminal. Result ```zsh: permission denied: /bin``` – DMW Jul 18 '21 at 20:16

0 Answers0