Vscode-code-runner: code-runner not working

Created on 28 Aug 2018  路  16Comments  路  Source: formulahendry/vscode-code-runner

I just installed VSCode recently (v1.26.1) on MacOS 10.13.6 and added code-runner. I tried it on a Python file and nothing happened upon executing "Run Code", either with anything selected or not. I then tried to choose Run Custom Command (the default one) and got this notification:

Running the contributed command:'code-runner.runCustomCommand' failed.

The Output window is completely empty.

I've tried to uninstall and reinstall, and also restart my computer.

question

Most helpful comment

I think I figured it out so I'll just document here in case it happens to
others.

Previously I installed some small extensions to run specific programs
before I stumbled upon code runner which is much more comprehensive. I set
the same key binding for them since I want to run everything with the same
command. I uninstalled the other extensions but somehow code runner still
didn't work. I just realized those extensions still lived in
~/.vscode/extensions even though vscode itself didn't list them anymore.
Removing these obsolete folders did the trick. Code runner now works on the
stable vscode release as well.

All 16 comments

idem for me, but in my case a popup show : "command 'code-runner.customCommand' not found" when using the keybinding :

C:\UsersxxxAppData\RoamingCode\User\keybindings.json
{
"key": "ctrl+s",
"command": "code-runner.customCommand",
"when": "editorTextFocus && editorLangId == 'scss'"
}
and in : C:\UsersxxxAppData\RoamingCode\User\settings.json , I added :
"code-runner.customCommand": "echo Marc"

but it's working using ctrl+shift +p "run custom command"

For me it doesn't work at all. If I try to run Python, for example, nothing happens and the OUTPUT window is empty. I tried to run the custom command in both ways, using the default keybinding ctrl + option + K and the Command Palette, I get the same popup notification. The difference is that the symbol on the notification is a red cross error sign if I run with the Command Palette, and a yellow warning sign if I run with the shortcut.

I already tried to disable all other extensions except this one to see if it makes a difference, but it doesn't. Basically I've never been able to get Code Runner to work at all.

@linhtto Please delete the C:\Users\***\.vscode\extensions\formulahendry.code-runner-*** folder and install extension again.

@marcdahan You need to use code-runner.runCustomCommand

@formulahendry , I use Mac, so the folder is in ~/.vscode/extensions. I deleted and reinstalled. But the same thing happens, I can't run anything. It doesn't matter if I turn on or off runInTerminal either.

How about Run Code command?

It doesn't do anything at all. There's no notification, but the
Terminal/Output are just empty and there's no sign of anything running.

Could you try VS Code Insider?

I just installed a fresh VS Code Insider and then Code Runner. And with this it works. I'm very confused about this.

[Running] echo Hello
Hello

[Done] exited with code=0 in 0.011 seconds

I reinstalled all my other packages (not too many and mostly standard ones), and it still works with VS Code Insider, but not VS Code the latest version 1.26.1 on MacOS 10.13.6.

It may be the issue of VS Code, not this extension. So closing it.

I think I figured it out so I'll just document here in case it happens to
others.

Previously I installed some small extensions to run specific programs
before I stumbled upon code runner which is much more comprehensive. I set
the same key binding for them since I want to run everything with the same
command. I uninstalled the other extensions but somehow code runner still
didn't work. I just realized those extensions still lived in
~/.vscode/extensions even though vscode itself didn't list them anymore.
Removing these obsolete folders did the trick. Code runner now works on the
stable vscode release as well.

Turns out I had a similar issue:
Microsoft One Note uses ctrl+alt+n, so if you have that open Code-runner won't go

I encountered the same problem.
But just empty the ~/.vscode folder do not help me.
At last, I realize that may be the cause of the cache. So I cleaned the folder of "$HOME/Library/Application\ Support/Code"

Yeah the code runner is working again.

I updated VS Code and solved it

I went to accounts/user(GITHUB) -Manage Trusted Extensions, typed code-runner in the command pallette and another instance of VS Code opened. I opened a Python file and tried CTR+ALT+N and it worked? I was troubleshooting most of the day and just tried a random thing. Is there a hotkey for permissions that I might have hit?

how can i fix this with code runner
[Running] python -u "c:\Users\Serban\classes.py"
<__main__.Dog object at 0x000002C32DBC7D00>

[Done] exited with code=0 in 0.169 seconds

Was this page helpful?
0 / 5 - 0 ratings