lukehaas / RunJS

RunJS is a JavaScript playground for macOS, Windows and Linux. Write code with instant feedback and access to Node.js and browser APIs.
https://runjs.app
2.05k stars 44 forks source link

Package `sharp` gets installed but fails to run #617

Closed kapooostin closed 1 month ago

kapooostin commented 7 months ago

I installed sharp package. But it cannot be loaded:

Error: Could not load the "sharp" module using the darwin-x64 runtime

Is there any way to use it in RunJS?

My log is below

{
  "version": "2.11.0",
  "platform": "darwin",
  "arch": "x64",
  "activated": true,
  "logs": [
    {
      "path": "/Users/USER/Library/Logs/runjs/main.log",
      "lines": [
        "[2024-03-12 17:07:06.694] [warn]  sysctl shell command to check for macOS Rosetta environment failed: Error: Command failed: sysctl sysctl.proc_translated",
        "sysctl: unknown oid 'sysctl.proc_translated'",
        "",
        "[2024-03-13 22:23:44.537] [warn]  sysctl shell command to check for macOS Rosetta environment failed: Error: Command failed: sysctl sysctl.proc_translated",
        "sysctl: unknown oid 'sysctl.proc_translated'",
        "",
        "[2024-04-05 15:07:44.062] [error] Unhandled TypeError: Cannot read properties of undefined (reading 'libraryDefaultDir')",
        "    at Function.resolvePathFn (/Applications/RunJS.app/Contents/Resources/app.asar/entry-bundle.js:14:97807)",
        "    at Function.readAllLogs (/Applications/RunJS.app/Contents/Resources/app.asar/entry-bundle.js:14:97314)",
        "    at click (/Applications/RunJS.app/Contents/Resources/app.asar/entry-bundle.js:8:90678)",
        "    at MenuItem.click (node:electron/js2c/browser_init:2:29559)",
        "    at a._executeCommand (node:electron/js2c/browser_init:2:34987)",
        ""
      ]
    }
  ]
}
lukehaas commented 7 months ago

Thanks, @kapooostin. I've just had a look, and I'm seeing the same thing in the current version of RunJS. However, it is working in the latest release candidate which will be released as RunJS version 2.12.0 at some point within the next few weeks.

kapooostin commented 7 months ago

Great! Is there a way to install RC-version beforehand?

btecu commented 7 months ago

Seems like this might still be an issue in latest version.

lukehaas commented 7 months ago

@btecu interesting, you're right. It looks like it only works for me when I'm running in dev mode, not prod. Sorry, @kapooostin, I will need to look into this further.

lukehaas commented 7 months ago

@kapooostin for the moment, you could try manually installing it in this directory: ~/Library/Application\ Support/runjs

kapooostin commented 6 months ago

@lukehaas I'd love to, Sorry, how exactly could I do it?

lukehaas commented 6 months ago

If you're on mac, navigate to ~/Library/Application\ Support/runjs in your terminal and then run npm install sharp.

kapooostin commented 6 months ago

I updated RunJS and now it loads sharp. But cannot use it

image

WIll try to install it manually, sec...

kapooostin commented 6 months ago

Installing sharp manually makes it work, indeed.

lukehaas commented 1 month ago

@kapooostin @btecu this seems to be working ok now in the latest release.

kapooostin commented 3 weeks ago

@kapooostin @btecu this seems to be working ok now in the latest release.

Yep, it works great, thank you!