javascriptstringsublimetext3build-system

JavaScript String Generator - Not Working (Sublime Text 3)


I am using Sublime Text 3 and whenever I build it with my build system for JavaScript. It gives me an error. Code below as well as error:

function makeid(length) {
    let result = '';
    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    const charactersLength = characters.length;
    let counter = 0;
    while (counter < length) {
      result += characters.charAt(Math.floor(Math.random() * charactersLength));
      counter += 1;
    }
    return result;
}

console.log(makeid(5));

And then the error:

[WinError 2] The system cannot find the file specified
[cmd: ['/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc', 'C:\\Users\\me\\Documents\\Projects\\Password Generator\\script.js']]
[dir: C:\Users\me\Documents\Projects\Password Generator]
[path: C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\National Instruments\Shared\OpenVINO\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\me\AppData\Local\Microsoft\WindowsApps]
[Finished]

I tried running the code and it didn't work and I'm expecting it to generate me a random string.


Solution

  • Your "build system for JavaScript" expects you to have a /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc binary - that's an obviously macOS path, and you're evidently running on Windows.

    You'll want e.g. node.js if you want to run console JavaScript on Windows, and then fix your build system to use node instead.