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

Warning from find command when use nvm run with .nvmrc #871

Closed
dr15x86 opened this issue Oct 13, 2015 · 10 comments
Closed

Warning from find command when use nvm run with .nvmrc #871

dr15x86 opened this issue Oct 13, 2015 · 10 comments
Assignees
Labels
bugs Oh no, something's broken :-(

Comments

@dr15x86
Copy link

dr15x86 commented Oct 13, 2015

If current directory have .nvmrc and you call nvm run <full_path_to_script>, nvm write to sdout: find: warning: Unix filenames usually don't contain slashes (though pathnames do).......

How check:

    mkdir /tmp/find_warn
    cd /tmp/find_warn
    echo stable > .nvmrc
    echo 'console.log("hi")' > hi.js
    nvm run /tmp/find_warn/hi.js

It print to stderr

    find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name `/tmp/find_warn/hi.js.*'' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ `/tmp/find_warn/hi.js.*''.

If you call relative path nvm run hi.js all good.
but if script name start with digits (nvm run 123.js), nvm write N/A: version "v123.js" is not yet installed and exit.

May be add for nvm use and nvm run argument -- for separate node version and user command? Or special argument --use-node-version-from-nvmrc and not use heuristics for detect node version?

nvm debug:

    $SHELL: /bin/bash
    $NVM_DIR: '$HOME/.nvm'
    $PREFIX: ''
    $NPM_CONFIG_PREFIX: ''
    nvm current: v4.2.0
    which node: $NVM_DIR/versions/node/v4.2.0/bin/node
    which iojs: 
    which npm: $NVM_DIR/versions/node/v4.2.0/bin/npm
    npm config get prefix: $NVM_DIR/versions/node/v4.2.0
    npm root -g: $NVM_DIR/versions/node/v4.2.0/lib/node_modules

Distributive: Debian GNU/Linux 8.2 (jessie)

find --version: find (GNU findutils) 4.4.2

bash --version:
GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Oct 13, 2015
@ljharb
Copy link
Member

ljharb commented Oct 13, 2015

Thanks for the report! I'll look into it.

@mjhasbach
Copy link

+1

@ljharb
Copy link
Member

ljharb commented Oct 18, 2015

@mjhasbach can you also provide your nvm debug output, as well as echo $NVM_DIR if it's not already there?

@mjhasbach
Copy link

nvm debug

$SHELL: /bin/bash
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: v4.2.1
which node: $NVM_DIR/versions/node/v4.2.1/bin/node
which iojs:
which npm: $NVM_DIR/versions/node/v4.2.1/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v4.2.1
npm root -g: $NVM_DIR/versions/node/v4.2.1/lib/node_modules

/www/test/test.js

console.log('pong');

nvm run /www/test/test.js

find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name `/www/test/test.js.*'' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ `/www/test/test.js.*''.
No .nvmrc file found
Running node v4.2.1 (npm v2.14.7)
pong

@ljharb
Copy link
Member

ljharb commented Jun 25, 2016

@dr15x86 @mjhasbach would you each mind updating to the latest nvm, and see if this problem still occurs?

@ljharb ljharb self-assigned this Jun 25, 2016
@dr15x86
Copy link
Author

dr15x86 commented Jun 25, 2016

I get latest version nvm from master (commit e1fdd31)
This warning I repeated as it is written in the first message.

dima@dbigbox:/tmp/find_warn$ nvm run /tmp/find_warn/hi.js
find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name `/tmp/find_warn/hi.js.*'' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ `/tmp/find_warn/hi.js.*''.
Found '/tmp/find_warn/.nvmrc' with version <stable>
Running node v6.2.2 (npm v3.9.5)
hi

My system:

Debian GNU/Linux 8.5 (jessie)

nvm debug:

nvm --version: v0.31.2
$SHELL: /bin/bash
$HOME: /home/dima
$NVM_DIR: '/tmp/nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: v6.2.2
which node: $NVM_DIR/versions/node/v6.2.2/bin/node
which iojs: 
which npm: $NVM_DIR/versions/node/v6.2.2/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v6.2.2
npm root -g: $NVM_DIR/versions/node/v6.2.2/lib/node_modules

bash --version:

GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)

find --version

find (GNU findutils) 4.4.2

@ljharb
Copy link
Member

ljharb commented Jun 25, 2016

Thanks! I'll keep taking a look at this.

@sebthom
Copy link
Contributor

sebthom commented Jul 20, 2016

I get a similar error with nvm ls

myhost:/opt/ci/nvm $ nvm ls
->     v0.12.15
default -> 0.12.15 (-> v0.12.15)
node -> stable (-> v0.12.15) (default)
stable -> 0.12 (-> v0.12.15) (default)
iojs -> N/A (default)
find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name `lts/argon.*'' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ `lts/argon.*''.
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.4.7 (-> N/A)
myhost:/opt/ci/nvm $ nvm --version
0.31.3

myhost:/opt/ci/nvm $ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)

myhost:/opt/ci/nvm $ bash --version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)

myhost:/opt/ci/nvm $ find --version
find (GNU findutils) 4.4.2

The offending line is https://github.com/creationix/nvm/blob/master/nvm.sh#L817
which translates into the following command showing with the known warning message:

command find /opt/ci/nvm/alias /opt/ci/nvm/bin /opt/ci/nvm/nvm-exec /opt/ci/nvm/nvm.sh /opt/ci/nvm/versions /opt/ci/nvm/versions/node/v0.12.15 /opt/ci/nvm/versions/node/v0.12.15 -name . -o -type d -prune -o -name lts/argon.*

@ljharb ljharb closed this as completed in e0e1c03 Jul 20, 2016
@ljharb
Copy link
Member

ljharb commented Jul 20, 2016

@dr15x86 Could you file a separate issue for the part about the filename starting with numbers?

@ljharb ljharb added bugs Oh no, something's broken :-( and removed needs followup We need some info or action from whoever filed this issue/PR. labels Jul 20, 2016
@dr15x86
Copy link
Author

dr15x86 commented Jul 20, 2016

@ljharb Ok. Tomorrow I recheck bug with numbers and create new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs Oh no, something's broken :-(
Projects
None yet
Development

No branches or pull requests

4 participants