misogi / vscode-ruby-rubocop

Rubocop extension for Visual Studio Code
https://marketplace.visualstudio.com/items/misogi.ruby-rubocop
MIT License
137 stars 68 forks source link

/usr/bin/env: ‘ruby’: No such file or directory #105

Open conradwt opened 5 years ago

conradwt commented 5 years ago

When I type Control + S within a Ruby file, I'm seeing the following error notifications in VS Code - Insiders:

/usr/bin/env: ‘ruby’: No such file or directory

Source: ruby-rubocop (Extension)
An error occured during autocorrection

Source: ruby-rubocop (Extension)

At this time, my settings.json looks as follows:

{
    "workbench.sideBar.location": "right",
    "terminal.integrated.shell.linux": "/usr/bin/zsh",
    "extensions.ignoreRecommendations": false,
    "ruby.rubocop.executePath": "/home/<user-name>/.rbenv/shims/",
    "[ruby]": {
        "editor.formatOnSave": true
    },
    "ruby.format": "rubocop",
    "editor.formatOnSaveTimeout": 1500,
    "remote.extensionKind": {
      "misogi.ruby-rubocop": "workspace"
    }
}

Next, I'm using WSL 1 with Ubuntu 18.04 distro with the following VSCode extensions:

Windows side

PS C:\Windows\system32> code-insiders --list-extensions
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-ssh-explorer
ms-vscode-remote.remote-wsl
ms-vscode-remote.vscode-remote-extensionpack

WSL side

castwide.solargraph
misogi.ruby-rubocop
rebornix.ruby
conradwt commented 5 years ago

I was able to resolve this issue by doing the following:

mv $HOME/<ubuntu-username>/some-folder /mnt/c/Users/<windows-username>/Desktop/.
ln -s  /mnt/c/Users/<windows-username>/Desktop/some-folder $HOME/some-folder
cd $HOME/some-folder
code-insiders .

When I open a Ruby file within VSCode - Insiders, I can now see the problems in the editor as well as the PROBLEMS tab. The only thing that's not working is the autocorrect and I'll be looking at that later this weekend.