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

lstat error when reading laravel project #260

Closed
peterson-umoke opened this issue Feb 24, 2019 · 14 comments
Closed

lstat error when reading laravel project #260

peterson-umoke opened this issue Feb 24, 2019 · 14 comments

Comments

@peterson-umoke
Copy link

started to get this error from vscode everytime i try to reindex laravel project
image

Please can you help?

@peterson-umoke peterson-umoke changed the title lsat error when reading laravel project lstat error when reading laravel project Feb 24, 2019
@bmewburn
Copy link
Owner

bmewburn commented Feb 26, 2019

Unusre about this one. I've seen a similar error posted on the atom repo where if a network drive is in use and gets disconnected. Do you have nodejs installed?

@bmewburn bmewburn transferred this issue from another repository Feb 26, 2019
@peterson-umoke
Copy link
Author

Yes, I have node js installed?

@bmewburn
Copy link
Owner

I only ask because I think vscode will use the node version that comes with electron if there is no separately installed node version. I wondered if that could make a difference.

@mtsunu
Copy link

mtsunu commented Feb 26, 2019

For me, this happened because I'm running composer inside WSL. It seems that the extension can't follow symbolic link.

The workaround is running composer from windows console / git bash.

@peterson-umoke
Copy link
Author

@mtsunu , you are actually right i do use wsl with vscode, but once i switched to git bash or cmd.exe it still doesn't works fine,, but the issue was never there before?

what changed?

@bmewburn
Copy link
Owner

The file finding was moved to the server and no longer uses the vscode file finding api available in the extension host. Now this is used - https://github.com/mrmlnc/fast-glob

@peterson-umoke
Copy link
Author

oh.

Damn, does it support wsl?... cause i cant even use the extension with git bash or cmd.exe at all

@patrickcarlohickman
Copy link

Same problem here. When running composer inside WSL, it creates linux symlinks in the vendor/bin directory. Windows doesn't quite understand symlinks created in WSL, so running lstat from Windows (VSCode) throws an error.

I tried adding **/vendor/bin/** to the intelephense.files.exclude setting, but still got the same error. Seems like the fast-glob package is stating the files to determine if they should be excluded.

For a quick workaround for composer, you can set "bin-compat": "full" in your composer.json file, which tells composer to create Windows compatible shell scripts instead of symlinks in the vendor/bin directory. After updating the composer.json file, remove the vendor directory and reinstall (composer install).

Another workaround is to downgrade the extension in VSCode to v0.8.8.

@bmewburn
Copy link
Owner

bmewburn commented Feb 27, 2019

Thanks for the workaround @patrickcarlohickman

Anyone want to write a quick nodejs script and test globbing with https://www.npmjs.com/package/glob and see if that works?

@bmewburn
Copy link
Owner

microsoft/WSL#1524

@peterson-umoke
Copy link
Author

@patrickcarlohickman ... Thanks for the fix, issue resolved. Thanks so much.

@weogrim
Copy link

weogrim commented Mar 25, 2019

Same thing, when linking storage to public folder in Laraval 5.7:

php artisan storage:link

[Info - 16:47:03] Initialising [Info - 16:47:03] Reading state from c:\Users\dariu\AppData\Roaming\Code\User\workspaceStorage\352992bc5f574e91915ebc1d31678164\bmewburn.vscode-intelephense-client\4b7bd0d4. [Info - 16:47:04] Initialised in 598 ms [Info - 16:47:04] Intelephense 1.0.8 [Error - 16:47:04] Error: UNKNOWN: unknown error, lstat 'e:\firma\fbpopular\public\storage'

@patrickcarlohickman solution it is not applicable here, I think.

@patrickcarlohickman
Copy link

@weogrim Yeah, the composer stuff I mentioned won't help you out at all in this scenario. You can try making the link in windows, and hope WSL knows how to read it properly.

If you have php installed on your windows host, you can run php artisan storage:link from windows (not using WSL), and it will create the windows link. However, if you're like me, and use WSL to avoid having to install dev tools, this may not be an option.

If you don't have php installed and don't want to install it, you can run the mklink command yourself from a windows command prompt (adjust the paths as necessary).

mklink /J "e:\firma\fbpopular\public\storage" "e:\firma\fbpopular\storage\app\public"

This is the underlying command that php artisan storage:link would run. The /J option tells windows to create a hard link (directory junction). If WSL can't understand this, you can try using /D to create a soft link.

If creating the link in Windows does't resolve the issue, I think your only recourse would be to downgrade the extension to v0.8.8.

@marveloo
Copy link

marveloo commented May 2, 2019

I have found the best workaround is to enable "Developer mode" on Windows. From then on all newly created symlinks on WSL will be real symbolic links and not junctions.

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

6 participants