Sublime Forum

[WinError 2] The system cannot find the file specified(again)

#1

Hi all - I know this has been posted here before, but honestly I’m brand new to Sublime and javascript, NOT a programmer and am really having a hard time understanding the responses. Please forgive my ignorance (maybe this dog is too old to learn any new tricks)…

Sublime 3 installed to my default directory:
C:\Program Files (x86)
Note that I am unable to create / modify anything on this directory, so I created a new one for my files:
C:\Users\JP1360\javascript_files

I created a 1 line javascript file, saved it to the new directory (with the .js extention), selected JSC under TOOLS/BUILD SYSTEM (also tried “automatic”), and when I run it, I get the “[WinError 2] The system cannot find the file specified” error.

[cmd: [’/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc’, ‘C:\Users\JP1360\javascript_files\Sublime_Sandbox’]]

Again, I realize this topic has been discussed here before, but I’m really not following the answers.

Thank you for any assistance/guidance.

0 Likes

#2

What package did you install that gives you the JSC build system? It looks like it was designed for MacOS only?

0 Likes

#4

Hi…thanks for taking a look at my post.

The version installed is Sublime text V3 build 3083

I was trying to find out how to use the console (or whatever the window is that allows you to view your output), and found a script that I thought did what I expected (content below), Which I saved and ran - after that, JSC was a build system option:

{
"cmd": ["/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc", "$file"],
"selector": "source.js"
}
0 Likes

#5

I think what @kingkeith meant is that you seem to be running Windows (C:\Program Files\ is a windows path), but the command you’re trying to execute (/System/Library/) is a MacOS path, so it’s probably not meant to be used on windows.

1 Like

#6

Really going to show my ignorance here - but what command am I trying to run? All I’m doing is printing “Hello” to the console:
Console.log(“Hello”)

Do you happen to know if Visual Studio is more straight forward/easier for new users?

Thank you again - I sincerely appreciate your help

0 Likes

#7

The sublime-build file snippet you posted above is trying to run the command specified in cmd, which is "/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc", with $file representing the name of the current file, which gets passed to the command.

Basically internally Sublime knows how to edit text and it knows how to execute external programs, so for any particular programming language (C, Python, JavaScript, etc) Sublime gives you the power to edit the source files that you’re working with, but you need to tell it what external program to use to run your code.

In my experience, Visual Studio is in many ways complex for even experienced users (I myself use it only when I have no other option, preferring to use Sublime instead). That’s just me though. Possibly Visual Studio Code is a little easier to get into, but I haven’t tried it so I can’t say for sure.

One way to do what you’re trying to do here would be to first install NodeJS on your system; during this process, if there is a question about adding node to the system path, say yes. If it doesn’t ask, keep a note of where you installed it.

Then, you would want to replace the sample you have above with something like this instead:

{
    "cmd": ["node",  "$file"],
    "selector": "source.js"
}

Assuming that the NodeJS installer set up the path for you automatically, this is all you need to do:

If that doesn’t work, you will likely get the same error as above, where Windows is telling you that it can’t find the program you’re trying to run. In that case you would also need to either add the location of NodeJS to the system path or modify the command to point to it directly (like C:/Program Files/nodejs/node instead of node, if it happens to be installed in that path). How you go about editing the path is different depending on the version of windows that you’re using.

It’s been a long time since I installed nodejs on this machine, but it looks like it did the work for me without my having to do it myself, so that may not be an issue.

3 Likes

#8

Thank you so much for all of the great details and visuals! I’ve heard similar things about Visual Studio from others… I was hoping that since I’m more of a VBA guy, that the set up and language would be more intuitive, but apparently not!

Will give this Sublime thing another go, with the info you provided, before I jump out of our office window!

0 Likes

#9

Just to follow up - it worked!
THANK YOU!

1 Like