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

Got several output 'grep: XXX: Is a directory' everytime after opening terminal #2360

Closed
qomosoloto opened this issue Nov 26, 2020 · 18 comments

Comments

@qomosoloto
Copy link

Operating system and version:

OpenSuse

nvm debug output:

nvm --version: v0.37.1
$SHELL: /usr/bin/zsh
$SHLVL: 1
whoami: 'qomo'
${HOME}: /home/qomo
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/.yarn/bin:${HOME}/.config/yarn/global/node_modules/.bin:${HOME}/apps/influxdb/usr/bin:${NVM_DIR}/versions/node/v10.16.0/bin:${HOME}/bin:/usr/local/bin:/usr/bin:/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.8 (x86_64-suse-linux-gnu)'
uname -a: 'Linux 5.9.8-2-default #1 SMP Thu Nov 12 07:43:32 UTC 2020 (ea93937) x86_64 x86_64 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Welcome to openSUSE Tumbleweed 20201124 - Kernel  ().
curl: /usr/bin/curl, curl 7.73.0 (x86_64-suse-linux-gnu) libcurl/7.73.0 OpenSSL/1.1.1h-fips zlib/1.2.11 libidn2/2.3.0 libpsl/0.21.1 (+libidn2/2.3.0) libssh/0.9.5/openssl/zlib nghttp2/1.41.0
wget: /usr/bin/wget, GNU Wget 1.20.3 built on linux-gnu.
git: /usr/bin/git, git version 2.29.2
ls: 无法访问 'grep:': No such file or directory
grep: grep: aliased to grep --color=auto (grep --color=auto), grep (GNU grep) 3.5
awk: /usr/bin/awk, GNU Awk 5.1.0, API: 3.0
sed: /usr/bin/sed, sed (GNU sed) 4.8
cut: /usr/bin/cut, cut (GNU coreutils) 8.32
basename: /usr/bin/basename, basename (GNU coreutils) 8.32
rm: /usr/bin/rm, rm (GNU coreutils) 8.32
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.32
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0
nvm current: v10.16.0
which node: ${NVM_DIR}/versions/node/v10.16.0/bin/node
which iojs: iojs not found
which npm: ${NVM_DIR}/versions/node/v10.16.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v10.16.0
npm root -g: ${NVM_DIR}/versions/node/v10.16.0/lib/node_modules

nvm ls output:

->     v10.16.0
default -> v10.16.0
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v10.16.0) (default)
stable -> 10.16 (-> v10.16.0) (default)
lts/* -> lts/fermium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.23.0 (-> N/A)
lts/erbium -> v12.20.0 (-> N/A)
lts/fermium -> v14.15.1 (-> N/A)

How did you install nvm?

install script in readme.

What steps did you perform?

I just installed as said in readme.

What happened?

Well, everything good. But everytime after opening terminal , I got these output:

grep: CloudMusic: Is a directory
grep: develop: Is a directory
grep: go: Is a directory
grep: matrix-blog: Is a directory
grep: ssqian: Is a directory

These directories are under my home directory.

What did you expect to happen?

It would not happen when I was working on manjaro-linux. If I commented these lines in .zshrc, above outputs disappeared.

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

So, how to hide these outputs?

Is there anything in any of your profile files that modifies the PATH?

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export CLASSPATH=".:/usr/share/java/antlr-complete.jar:$CLASSPATH"
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$HOME/apps/influxdb/usr/bin:$PATH"
@ivancevich
Copy link

ivancevich commented Nov 26, 2020

I'm experiencing the same thing on Ubuntu 20.04.1 LTS after upgrading to NVM v0.37.1 - I had to manually roll back to v0.37.0

@ArmanMazdaee
Copy link

I have the same problem on archlinux with NVM v0.37.1 too

@ljharb
Copy link
Member

ljharb commented Nov 27, 2020

I can’t figure out why either of the two changes in v0.37.1 would have caused this. Perhaps #2347, cc @mdwint?

@ljharb
Copy link
Member

ljharb commented Nov 27, 2020

@qomosoloto this line in nvm debug is interesting: ls: 无法访问 'grep:': No such file or directory. What do those characters mean?

@ivancevich @ArmanMazdaee for both of you as well, is it listing every directory inside your home dir with that error message?

@qomosoloto
Copy link
Author

@qomosoloto this line in nvm debug is interesting: ls: 无法访问 'grep:': No such file or directory. What do those characters mean?

@ivancevich @ArmanMazdaee for both of you as well, is it listing every directory inside your home dir with that error message?

无法访问 means can't access

@qomosoloto
Copy link
Author

@qomosoloto this line in nvm debug is interesting: ls: 无法访问 'grep:': No such file or directory. What do those characters mean?

@ivancevich @ArmanMazdaee for both of you as well, is it listing every directory inside your home dir with that error message?

Now it is listing every directory inside any directory after excuting cd directory command...

@zhengdai
Copy link

I have the same problem on mac big sur 1.0.1 (20B29)

@zhengdai
Copy link

I found when I change
NVM_NPM_CONFIG_PREFIX_ENV="$(command env | nvm_grep -i ^NPM_CONFIG_PREFIX | command tail -1 | command awk -F '=' '{print $1}')"
to
NVM_NPM_CONFIG_PREFIX_ENV="$(command env | nvm_grep -i NPM_CONFIG_PREFIX | command tail -1 | command awk -F '=' '{print $1}')"

it's ok.

@mdwint
Copy link
Contributor

mdwint commented Nov 27, 2020

@zhengdai What's the output of command env?

@zhengdai
Copy link

@zhengdai What's the output of command env?

TERM_SESSION_ID=w0t2p0:12B5D2DB-541F-43A2-B8C0-EBB9F752B78F
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.TSYOKXRhk9/Listeners
LC_TERMINAL_VERSION=3.4.2
COLORFGBG=7;0
ITERM_PROFILE=Default
SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS=/Users/zhengdai/Library/WebKit/Databases
XPC_FLAGS=0x0
LANG=zh_CN.UTF-8
PWD=/Users/zhengdai
SHELL=/bin/zsh
__CFBundleIdentifier=com.googlecode.iterm2
SECURITYSESSIONID=186a9
TERM_PROGRAM_VERSION=3.4.2
TERM_PROGRAM=iTerm.app
PATH=/Users/zhengdai/.nvm/versions/node/v15.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/zhengdai/project/go/bin:/usr/local/opt/fzf/bin
LC_TERMINAL=iTerm2
COLORTERM=truecolor
COMMAND_MODE=unix2003
TERM=xterm-256color
HOME=/Users/zhengdai
TMPDIR=/var/folders/1n/sd9vsnzx0_75d_7xhr9w12cr0000gn/T/
USER=zhengdai
XPC_SERVICE_NAME=0
LOGNAME=zhengdai
LaunchInstanceID=41CDF862-97BC-4805-9D4C-4053564340BE
__CF_USER_TEXT_ENCODING=0x0:25:52
ITERM_SESSION_ID=w0t2p0:12B5D2DB-541F-43A2-B8C0-EBB9F752B78F
SHLVL=1
OLDPWD=/Users/zhengdai
BROWSER=open
EDITOR=vim
VISUAL=nano
PAGER=less
LESS=-F -g -i -M -R -S -w -X -z-4
ZSH=/Users/zhengdai/.oh-my-zsh
LSCOLORS=Gxfxcxdxbxegedabagacad
ZNT_REPO_DIR=/Users/zhengdai/.oh-my-zsh/plugins/zsh-navigation-tools
ZNT_CONFIG_DIR=/Users/zhengdai/.config/znt
JAVA_8_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
JAVA_15_HOME=/usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home
JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
GO111MODULE=on
GOPROXY=https://goproxy.cn
GOPATH=/Users/zhengdai/project/go
LESS_TERMCAP_mb=
LESS_TERMCAP_md=
LESS_TERMCAP_me=
LESS_TERMCAP_se=
LESS_TERMCAP_so=
LESS_TERMCAP_ue=
LESS_TERMCAP_us=
LS_COLORS=di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:
GREP_COLOR=37;45
GREP_COLORS=mt=37;45
NVM_DIR=/Users/zhengdai/.nvm
NVM_CD_FLAGS=-q
NVM_BIN=/Users/zhengdai/.nvm/versions/node/v15.3.0/bin
NVM_INC=/Users/zhengdai/.nvm/versions/node/v15.3.0/include/node
NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
_=/usr/bin/env

@mdwint
Copy link
Contributor

mdwint commented Nov 27, 2020

@zhengdai Did you run command env inside of nvm.sh, right above the line you changed?

I don't understand how changing the ^ could have had an impact if command env doesn't even output any possible matches.

@ljharb
Copy link
Member

ljharb commented Nov 27, 2020

Sounds like i need to revert #2347 ASAP; I’ll do that and cut a release today. @mdwint, we’ll need to reopen a PR to try to fix the original issue, but add a regression test to cover this case too.

@ljharb
Copy link
Member

ljharb commented Nov 28, 2020

Hmm, I'm unable to reproduce this in my local zsh on my (pre-big-sur) Mac in zsh.

@ljharb
Copy link
Member

ljharb commented Nov 28, 2020

@qomosoloto regardless, export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$HOME/apps/influxdb/usr/bin:$PATH" will break things - do that before sourcing nvm, so that nvm's node/npm/global modules always take precedence (especially over yarn's global modules).

@ljharb ljharb closed this as completed in 3b57dfe Nov 28, 2020
@ljharb
Copy link
Member

ljharb commented Nov 28, 2020

I've gone ahead and reverted #2347, which will be released shortly as v0.7.2. Hopefully that solves the problem.

@ljharb
Copy link
Member

ljharb commented Nov 28, 2020

v0.7.2 is released. Please file a new issue if there's still problems.

@mdwint
Copy link
Contributor

mdwint commented Dec 12, 2020

Would anyone who experienced this issue be willing to test #2368 on their machine? I want to make sure that it does not cause the same regression, but I'm having trouble reproducing the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@ljharb @mdwint @ivancevich @ArmanMazdaee @zhengdai @qomosoloto and others