n: n selector doesn't work

I installed n with npm install -g n

when I run $ n I get output:

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]

    node/4.4.7
    node/6.6.0
    node/7.2.1

when I run:

$ n 4.4.7 - nothing happens. No output, node version doesn’t change.

tried to reinstall n - same thing. Is there any --verbose flag?

 $ node -v
v7.1.0

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 11
  • Comments: 16

Most upvoted comments

Same issue here

Update: This was because i had nvm installed and active… Just did nvm use system to stop using nvm… Then n worked just fine 😃

@Brototype I’ve been facing this problem and i’ve resolve it following this steps : Uninstall n, node and npm

which n // give you path/n/bin/n
sudo rm -rf path/n
sudo rm -rf /usr/local/bin/n
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/bin/npm

Install n from a third-party installer curl -L https://git.io/n-install | bash

==> Enjoy

+1 using zsh. I have no nvm installed

 ~  nvm
zsh: command not found: nvm

For posterity, I experienced this because I installed yarn via brew, which in turn installed node via brew. Uninstalling brew’s version of node (have to use --ignore-dependencies flag b/c of yarn) solved it.

In my case brew’s node was conflicting with the n. So I removed node out from there. brew uninstall node --ignore-dependencies. It was installed along with yarn however yarn continue working after removing.

Make sure you uninstall your previous version of node. For example, if you are using OSX and MacPorts or brew, make sure which node points to /usr/local/bin/node (or the path you chose to install n node).

i have this issue too. Here is my output for brew list:

ack			emacs			gradle214		libtiff			protobuf		x264
bash-completion		ffmpeg			gradle@2.14		libyaml			ranger			xvid
boost			freetype		heroku			libzip			readline		zsh
cask			gdbm			icu4c			node@6			sdl2			zsh-completions
cloc			git			jpeg			oniguruma		sdl2_image
delve			git-flow		jq			openssl			tldr
docker			glew			kubernetes-cli		openssl@1.1		vagrant-completion
docker-compose		go			lame			pcre			webp
docker-machine		gource			libpng			pkg-config		wget

for some reason n gives me that output

    node/6.3.1
    node/8.1.3

and when i go up / down with the arrow keys i get this:

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]

    node/6.3.1
    node/8.1.3


The problem is that it can’t find the $versions_paths directory. This could be because find isn’t installed or the $N_PREFIX isn’t pointing to where the versions are installed.

@andresmihkelson Are you using a container or is this local? Make sure you have the findutils package. I have a container that you can test this on, if you have docker.

docker run troy0820/node-n-fedora
npm i -g n
n 4.6.0
n lts 
n latest

Install a couple of versions and then switch with n and you should see it work fine.

@digitalmaster thanks, fixed for me as well.