"No such file or directory" error on existing file?

14,376

You will find that /Users/myusername/.config/yarn/global/node_modules/vue-cli/bin/vue does not exist.

The symbolic link /usr/local/bin/vue exists, so you can see it with ls -l. But the target does not, so there's not really any file there.

You can confirm this with either of these two commands

ls -lL /usr/local/bin/vue
ls -l /usr/local/bin/../../../Users/myusername/.config/yarn/global/node_modules/vue-cli/bin/vue

The first tells ls to give you information about the target of the link rather than the link itself (-L). The second looks directly at the target.

Share:
14,376

Related videos on Youtube

Pieter
Author by

Pieter

Updated on September 18, 2022

Comments

  • Pieter
    Pieter almost 2 years

    I have an issue with a binary(?) that simultaneously seems to exist and not exist.

    $ ls -l /usr/local/bin/vue
    lrwxr-xr-x  1 myusername  admin  73 Jul 14 15:31 /usr/local/bin/vue -> ../../../Users/myusername/.config/yarn/global/node_modules/vue-cli/bin/vue
    $ /usr/local/bin/vue
    zsh: no such file or directory: /usr/local/bin/vue
    

    Any idea what's going on here?

    • Prvt_Yadav
      Prvt_Yadav almost 6 years
      Most probably you deleted the target file after linking it with /usr/local/bin/vue
    • Black Mamba
      Black Mamba over 5 years
      If you see this when running a shell script, it might be because of \r\n line endings that can be fixed by dos2unix. See stackoverflow.com/a/38193054/6517383