n selector doesn't work

Created on 18 Dec 2016  Â·  16Comments  Â·  Source: tj/n

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?

Most helpful comment

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 :)

All 16 comments

I get exactly this too.
using zsh

➜ ~ n --version
2.1.3

the up/down arrows on the selector don't work, and there is no arrow to indicate currently selected version.

I seem to have other issues with the node installation.
what is the best way to completely uninstall n?

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 :)

@digitalmaster thanks, fixed for me as well.

+1
using zsh.
I have no nvm installed

 ~ î‚° nvm
zsh: command not found: nvm

could be related to zsh, i also have the issue and am using zsh.

I am using bash and with the latest n, the same happens. No nvm also. Using Fedora 24. Also, after running n fails, I cannot type anything into the prompt any more.

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).

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.

@troy0820 It was locally installed and findutils was also installed. But probably something unrelated to n was responsible, because today I reinstalled n through npm again and it works fine. Thanks anyways! (:

Are you still having this issue @af-fess?

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.

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

ack         emacs           gradle214       libtiff         protobuf        x264
bash-completion     ffmpeg          [email protected]     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      [email protected]     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


@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

Worked for me!

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.

in my case, node was install in /usr/local/bin which not in the env path, so just add export PATH="$PATH:/usr/local/bin"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mesqueeb picture mesqueeb  Â·  4Comments

GeoffreyBooth picture GeoffreyBooth  Â·  8Comments

Olgagr picture Olgagr  Â·  4Comments

dfuentes77 picture dfuentes77  Â·  8Comments

qw3rtman picture qw3rtman  Â·  6Comments