Sandpack / nodebox-runtime

Nodebox is a runtime for executing Node.js modules in the browser.
https://sandpack.codesandbox.io/docs/advanced-usage/nodebox
Other
727 stars 41 forks source link

"Error: Failed to get shell by ID ..." when running npm scripts #33

Closed frepps closed 1 year ago

frepps commented 1 year ago

Hello!

I get an error when running the example on https://github.com/codesandbox/nodebox-runtime/blob/main/README.md

Uncaught (in promise) Error: Failed to get shell by ID "clfv3ugjh0000039ox0avsv01"

It runs if I change: const nextProcess = await shell.runCommand('npm', ['dev']); to const nextProcess = await shell.runCommand('next', ['dev']);

I noticed the same issue in other projects also. npm scripts fails, while running, for example, node index.js works.

Example sandbox

(Open developer console and wait about 10 seconds for emulator.preview.getByShellId to time out)

DeMoorJasper commented 1 year ago

We don't emulate npm, we leave it up to higher level users like sandpack to implement that the npm logic for now.

So if you need this logic you can parse pkg.json and run it that way, if you think it's really important for us to have this we can implement it relatively quickly.