Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to avoid env: node: No such file or directory #1702

Closed
casprwang opened this issue Jan 7, 2018 · 18 comments
Closed

how to avoid env: node: No such file or directory #1702

casprwang opened this issue Jan 7, 2018 · 18 comments
Labels
performance This relates to anything regarding the speed of using nvm.

Comments

@casprwang
Copy link

casprwang commented Jan 7, 2018

  • 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 the PATH?

  • If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?
@ljharb
Copy link
Member

ljharb commented Jan 7, 2018

Try nvm alias default node

@casprwang
Copy link
Author

@ljharb thanks for the quick response, but I tried that with no luck. My guess is that aliasing in nvm would not work since I am not loading nvm when I start the terminal. Can I just symlink the /usr/bin/node with nvm's node in shell?

@ljharb
Copy link
Member

ljharb commented Jan 8, 2018

You definitely don’t want to do that. Why aren’t you loading nvm in your profile files? That’s required to be able to use nvm.

@casprwang
Copy link
Author

Ok, thanks for clarifying. Well, I use terminal a lot and nvm adds about 2s to my shell's starting time, which is annoying to me. I only use node occasionally.

@casprwang
Copy link
Author

casprwang commented Jan 8, 2018

The confusing part is that I should be ok to not use node. while after installing nvm, it will always keep hinting for not having unexecutatble node in /bin.

@ljharb
Copy link
Member

ljharb commented Jan 8, 2018

What do you mean by “hinting”? If you have something in your profile files that references node, that might do it.

@casprwang
Copy link
Author

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

@ljharb ljharb added the performance This relates to anything regarding the speed of using nvm. label Jan 8, 2018
@RyanPWalker
Copy link

RyanPWalker commented Dec 5, 2018

On macOS High Sierra, I had to run sudo chown -R $(whoami) $(brew --prefix)/*
source
and then run brew link --overwrite node

@mrsoftware
Copy link

use this comment to create a symlink:

sudo ln -s "$(which node)" /usr/bin/node

@dcefram
Copy link

dcefram commented Nov 30, 2020

On macOS High Sierra, I had to run sudo chown -R $(whoami) $(brew --prefix)/*
source
and then run brew link --overwrite 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.

@johnsoncwb

This comment has been minimized.

@wiegell
Copy link

wiegell commented Aug 7, 2022

On newer macos with readonly /usr/bin, do this instead (assuming node only installed through nvm, not brew):

sudo ln -s "$(which node)" /System/Volumes/Data/usr/local/bin

@mssoliveira

This comment was marked as resolved.

@maganezf

This comment was marked as resolved.

@ricardowoj

This comment was marked as spam.

@ericmp33

This comment was marked as spam.

@Norcy

This comment was marked as spam.

@lucastnr

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance This relates to anything regarding the speed of using nvm.
Projects
None yet
Development

No branches or pull requests