Hi there!
I'm Arisa, a freelance Full Stack Developer living in Germany🇩🇪
I'm developing Lilac, an online school with hands-on Frontend e-books and tutoring👩💻
n installation failure(or actually, it's installed but no configured PATH)
You'll see a log after your installation👇
/Users/YOUR_USER_NAME/.npm-packages/bin/n -> /Users/YOUR_USER_NAME/.npm-packages/lib/node_modules/n/bin/n
+ n@7.0.1
updated 1 package in 0.338s
But when you come and check on n...
bash: n: command not found
WHY?🤷♀️🤷♀️🤷♀️🤷♀️
I mean, you showed me you're installed..right?
Anyone who suffers from `"n: command not found"`
node: v14.14.0
macOS Catalina
It's actually not that nightmare than you think.
All you need to do is just configure into the right PATH.
Mostly, if your OS(macOS) is Catalina or higher, you're using zsh.
But sometimes, you're still using bash.
Make sure before you read further process.
Depends on what you use, your config file name is different.
You can check it out by this command.
$ echo $SHELL
# you'll see /usr/local/bin/zsh if you use zsh
If you're bash .bash_profile
If you're zsh .zshrc
Make sure to create in root.
If you're a vimmer, go ahead with vim.
I'm not that vimmer person.
If you're also not much vimmer, follow me🏃♀️
Open your config file with a text editor.
If you use VS Code and your config file is zsh, the command is something like this.
$ open ~/.zshrc -a code
Check a log when you installed n.
You'll use this PATH to correct the PATH for n.
The basic command is this.
export PATH=(YOUR_PATH_FROM_LOG):$PATH
Fill in your config file to set up the PATH based above.
export PATH=$HOME/.npm-global/lib/node_modules/n/bin:$PATH
Don't forget this process.
$ source ~/.zshrc
If things are not working, come back and make sure you applied what you configured.
Check your n version.
$ n --version
You'll be able to see n's version🎉
Hope this article solved what you're struggling.
Ciao👋