14

I'm using Visual Studio Code for Mac, running extension CodeRunner. I've got a simple program:

using System;
namespace HelloWorldApplication {
class HelloWorld {
   static void Main(string[] args) {
      Console.WriteLine("hellowol");
   }
 }
}

When I run it using the play button in the upper right hand corner I get the following error:

/bin/sh scriptcs: command not found

Then

[Done] exited with code=127 in 0.008 seconds

The program does not show the desired output.

EDIT: Much thanks to @VonC. His approach worked. Pro tip for anyone: install scriptcs using

brew install scriptcs
SSteve
  • 10,550
  • 5
  • 46
  • 72
jamesfdearborn
  • 769
  • 1
  • 10
  • 26

1 Answers1

8

Considering the prerequisite for filipw/vscode-scriptcs-runner is:

scriptcs should be installed on your machine.

Make sure to launch VSCode from a shell session where scriptcs is in your $PATH (meaning which scriptcs does not return an empty output)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • thanks so much for helping. This fixed it but now I have a new error: Unexpected named argument: Users/jfitz/Projects/Projtest/test.cs – jamesfdearborn Aug 20 '18 at 04:50
  • @jamesfdearborn That would be better asked as a separate question. – VonC Aug 20 '18 at 04:56
  • Will do in 90 minutes, when I can post questions. – jamesfdearborn Aug 20 '18 at 05:05
  • @Vonc Hi VonC I am sorry to disturb you, I find similar issue, I run "which scriptcs" it gives me /usr/local/bin/scriptcs. And I start Visual code from a shell session by running following command: "/Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron", but when I run the code it still displays this error. Could you advise? Thanks a lot. – Huibin Zhang Sep 17 '19 at 15:19
  • 1
    @HuibinZhang Electron? VSCode should be launched by typing `code`. See https://code.visualstudio.com/docs/editor/command-line and https://code.visualstudio.com/docs/setup/mac. See if the issue persists when VSCode is launched that way. – VonC Sep 17 '19 at 15:38
  • @Vonc thanks for kind reply. I will try this and let you know:) – Huibin Zhang Sep 17 '19 at 15:47
  • @HuibinZhang Since it is still failing, try and display PATH within vscode (using a console) – VonC Sep 17 '19 at 16:06
  • @Vonc hi I tried display PATH it looks like this: C02RW5PQG8WN:~ i333417$ which scriptcs /usr/local/bin/scriptcs C02RW5PQG8WN:~ i333417$ scriptcs "/var/folders/sr/5jzw91rn4g3cc2b0xyhw0j100000gq/T/tempCodeRunnerFile.csharp" Unexpected named argument: var/folders/sr/5jzw91rn4g3cc2b0xyhw0j100000gq/T/tempCodeRunnerFile.csharp C02RW5PQG8WN:~ i333417$ – Huibin Zhang Sep 18 '19 at 05:50
  • @Vonc Hi it still display command not found. I mean I tried copy "/var/folders/sr/5jzw91rn4g3cc2b0xyhw0j100000gq/T/tempCodeRunnerFile.csharp" statement and paste to terminal to run, it gives me "Unexpected named argument:" error, but on the output window it still say /bin/sh: scriptcs: command not found – Huibin Zhang Sep 18 '19 at 08:56
  • @Vonc, I don't know why it gives me the scriptcs command not found error as I type scriptcs in the terminal, it doesn't give me that error. – Huibin Zhang Sep 18 '19 at 08:59
  • @Vonc, it is weird, now after I click run it gives me "Unexpected named argument: var/folders/sr/5jzw91rn4g3cc2b0xyhw0j100000gq/T/tempCodeRunnerFile.csharp". Could you let me know how to proceed? Thanks – Huibin Zhang Sep 18 '19 at 09:09
  • @HuibinZhang Then it would be better to explain that issue in a separate question (with a link back to this one) – VonC Sep 18 '19 at 09:53
  • @VonC I have post a separated question https://stackoverflow.com/questions/57990818/got-unexpected-named-argument-error-when-running-csharp-code-on-visual-studio. Thanks. – Huibin Zhang Sep 18 '19 at 10:38