Sandpack/nodebox-runtime

Cannot find module '/nodebox/npm'

Opened this issue · 0 comments

Should npm just work as expected within the nodebox? Whenever I try to run any npm command, I get an error saying npm is not available.

For example, if I init the nodebox with a simple package.json with a dev script, when I run:

const info = await sh.runCommand('npm', ['dev'])

I get the error:

{
    "code": "MODULE_NOT_FOUND",
    "parent": "/nodebox/index.js",
    "filepath": "/nodebox/npm",
    "message": "Cannot find module '/nodebox/npm' from '/nodebox/index.js'",
    "name": "Error",
    "stack": "Error: Cannot find module '/nodebox/npm' from '/nodebox/index.js'\n    at _0x16e72a.internalResolveSync (https://nodebox-runtime.codesandbox.io/worker-686mf2jx5zo3t9z5wedt8t80gxsi6jq.js:105:1216259)\n    at _0x16e72a.resolveSync (https://nodebox-runtime.codesandbox.io/worker-686mf2jx5zo3t9z5wedt8t80gxsi6jq.js:105:1218044)\n    at _0x4cdf65 (https://nodebox-runtime.codesandbox.io/worker-686mf2jx5zo3t9z5wedt8t80gxsi6jq.js:105:1218585)\n    at _0x4007f6.resolveModule (https://nodebox-runtime.codesandbox.io/worker-686mf2jx5zo3t9z5wedt8t80gxsi6jq.js:105:1238851)\n    at _0x4007f6.load (https://nodebox-runtime.codesandbox.io/worker-686mf2jx5zo3t9z5wedt8t80gxsi6jq.js:105:1240113)\n    at _0xfde67f.loadEsModule (https://nodebox-runtime.codesandbox.io/worker-686mf2jx5zo3t9z5wedt8t80gxsi6jq.js:105:1246657)\n    at _0x17376b (https://nodebox-runtime.codesandbox.io/worker-686mf2jx5zo3t9z5wedt8t80gxsi6jq.js:105:2329245)\n    at MessagePort._0x4c72c8 (https://nodebox-runtime.codesandbox.io/worker-686mf2jx5zo3t9z5wedt8t80gxsi6jq.js:105:2328259)"
}

Just wondering if this is a bug, or if there's something I'm meant to do to make npm available as a command?