nvm: how to avoid env: node: No such file or directory
- Operating system and version: macOS 10.13.2 (17C88)
nvm debug
output:
nvm --version: v0.33.8
$TERM_PROGRAM: iTerm.app
$SHELL: /usr/local/bin/zsh
$HOME: /Users/song
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.4.2 (x86_64-apple-darwin15.6.0)'
uname -a: 'Darwin 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64'
OS version: Mac 10.13.2 17C88
curl: /usr/bin/curl, curl 7.54.0 (x86_64-apple-darwin17.0) libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
wget: /usr/local/bin/wget, GNU Wget 1.19.2 built on darwin15.6.0.
git: git: aliased to hub (hub), git version 2.15.0
grep: /usr/bin/grep, grep (BSD grep) 2.5.1-FreeBSD
awk: /usr/bin/awk, awk version 20070501
sed: illegal option -- -
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
sed: /usr/bin/sed,
cut: illegal option -- -
usage: cut -b list [-n] [file ...]
cut -c list [file ...]
cut -f list [-s] [-d delim] [file ...]
cut: /usr/bin/cut,
basename: illegal option -- -
usage: basename string [suffix]
basename [-a] [-s suffix] string [...]
basename: /usr/bin/basename,
rm: illegal option -- -
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
rm: rm: aliased to trash (trash),
mkdir: illegal option -- -
usage: mkdir [-pv] [-m mode] directory ...
mkdir: /bin/mkdir,
xargs: illegal option -- -
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
[-L number] [-n number [-x]] [-P maxprocs] [-s size]
[utility [argument ...]]
xargs: /usr/bin/xargs,
nvm current: v8.9.4
which node: $NVM_DIR/versions/node/v8.9.4/bin/node
which iojs: iojs not found
which npm: $NVM_DIR/versions/node/v8.9.4/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v8.9.4
npm root -g: $NVM_DIR/versions/node/v8.9.4/lib/node_modules
nvm ls
output:
default -> 8 (-> v8.9.4)
node -> stable (-> v8.9.4) (default)
stable -> 8.9 (-> v8.9.4) (default)
iojs -> N/A (default)
-
How did you install
nvm
? (e.g. install script in readme, homebrew): install script -
What steps did you perform? I commented the loading nvm script in shell to make my terminal loads faster, then load nvm whenever I need Node.js
-
What happened?
env: node: No such file or directory
shows up every new terminal opened -
What did you expect to happen? nothing like that shows up even I am not loading nvm(or, I am not using Node.js)
-
Is there anything in any of your profile files (
.bashrc
,.bash_profile
,.zshrc
, etc) that modifies thePATH
?
- If you are having installation issues, or getting “N/A”, what does
curl -I --compressed -v https://nodejs.org/dist/
print out?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 18 (3 by maintainers)
On macOS High Sierra, I had to run
sudo chown -R $(whoami) $(brew --prefix)/*
source and then runbrew link --overwrite node
On newer macos with readonly
/usr/bin
, do this instead (assuming node only installed through nvm, not brew):Try
nvm alias default node
@RyanPWalker this would only work if you installed node through homebrew. This wouldn’t work if you opted not to install node and only use nvm directly.
@mrsoftware’s suggestion would work in this case assuming that you use bash, and not something else like fish. You’ll have to re-link it though each time you change your node version if in case you want those shebang lines to use the selected node version.
edit: or if linking to
/usr/bin/node
is not permitted, you can link it to/usr/local/bin
. Those shebangs should still work with that.use this comment to create a symlink:
This work for me
it worked for me, using chip m1, thanks a lot!!
it’s working for me, in chip m2, Thank’s
@ljharb sorry for the confusion, I was meaning
env: node: No such file or directory
. After another peek, it seems the long loading time is an issue posted by others at multiple times, so I am closing this one. FWIW, my workaround is to use nvm in bash instead of zshell.