Title. I’m trying to compile this but I can’t seem to do so with node.js.

Thanks in advance.

  • @[email protected]OP
    link
    fedilink
    English
    1
    edit-2
    7 months ago

    Frankly, I know little to none regarding js, but I suppose I’m trying to “bundle” everything into a single binary so it can run in CLI, or in an external window if the former is not possible.

    • @[email protected]
      link
      fedilink
      47 months ago

      JavaScript does not compile to binary. It’s a scripting language that is run by an interpreter, which may or may not compile it on the fly to run alongside whatever else the interpreter is doing.

      The most obvious JS interpreter is a browser, which runs JS alongside an HTML/CSS rendering engine, do draw stuff for you.

      Node.js is a JS interpreter that runs JS inside/alongside an HTTP server, mainly in the interest of of web developers wanting to share JS code between both the server and client.

      Electron is a JS interpreter that essentially launches a trimmed-down version of Chrome inside a window on your OS desktop, whuch became popular among web developers already familiar with JS wanting to or being forced to expand into desktop app development.

      It looks like you’re essentially trying to create a screensaver? HTML/CSS/JS is simply not the tool for that.

      • @[email protected]OP
        link
        fedilink
        English
        27 months ago

        Thank you for your explanation. Not “create”, but use that specific package in the OP as a command to run it as a “lightweight screensaver” of sorts. And I honestly thought it was possible considering nexe and pkg exists and both can “compile” .js files into a binary. And the possibility of displaying pictures in true color (even in the CLI).

        • @[email protected]
          link
          fedilink
          37 months ago

          I think generally when a tool says that it’s compiling JavaScript into a binary, it’s just packaging it with a lightweight browser basically. Python has kind of the same thing - they have compilers that build executables, but really they’re just packaging a Python interpreter with your script.

    • @[email protected]
      link
      fedilink
      0
      edit-2
      7 months ago

      JS is an interpeted language, you can’t bundle stuff into a single binary. A “single binary” will require an interpreter to be bundled too, like Electton does