What version of Bun is running?
1.1.31-canary.58
What platform is your computer?
Linux 5.15.0-43-generic x86_64 x86_64 (7283453)
What steps can reproduce the bug?
bun install npm
bun build node_modules/npm/bin/npm-cli.js --compile --bytecode --outfile=bun-npm
Run the executable without removing the nodule_modules directory, works as expected.
bun-npm --help
npm <command>
Usage:
npm install install all the dependencies in your project
npm install <foo> add the <foo> dependency to your project
npm test run this project's tests
npm run <foo> run the script named <foo>
npm <command> -h quick help on <command>
npm -l display usage info for all commands
npm help <term> search for help on <term>
npm help npm more involved overview
All commands:
access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
help-search, hook, init, install, install-ci-test,
install-test, link, ll, login, logout, ls, org, outdated,
owner, pack, ping, pkg, prefix, profile, prune, publish,
query, rebuild, repo, restart, root, run-script, sbom,
search, set, shrinkwrap, star, stars, start, stop, team,
test, token, uninstall, unpublish, unstar, update, version,
view, whoami
Specify configs in the ini-formatted file:
/home/user/.npmrc
or on the command line via: npm <command> --key=value
More configuration info: npm help config
Configuration fields: npm help 7 config
npm@10.9.0 /home/user/bin/node_modules/npm
Remove the node_modules folder
What is the expected behavior?
The standalone executable shoule be standalone, without looking for the module source files of the executable on the machine.
What do you see instead?
Run the executable again, without node_modules directory on the machine, and the executable does not work as expected. Can't find a module in node_modules that doesn't exist.
bun-npm --help
error: Cannot find module "/home/user/bin/node_modules/npm/lib/cli/entry.js" from "/$bunfs/root/bun-npm"
at syntaxErrorHandler (/$bunfs/root/bun-npm:287:16)
Additional information
Compare compiling to a standalone executable with Deno
deno add npm:npm
deno compile -A --output=deno-npm node_modules/npm/bin/npm-cli.js
Run the executable to make sure it works
deno-npm --help
npm <command>
Usage:
npm install install all the dependencies in your project
npm install <foo> add the <foo> dependency to your project
npm test run this project's tests
npm run <foo> run the script named <foo>
npm <command> -h quick help on <command>
npm -l display usage info for all commands
npm help <term> search for help on <term>
npm help npm more involved overview
All commands:
access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
help-search, hook, init, install, install-ci-test,
install-test, link, ll, login, logout, ls, org, outdated,
owner, pack, ping, pkg, prefix, profile, prune, publish,
query, rebuild, repo, restart, root, run-script, sbom,
search, set, shrinkwrap, star, stars, start, stop, team,
test, token, uninstall, unpublish, unstar, update, version,
view, whoami
Specify configs in the ini-formatted file:
/home/user/.npmrc
or on the command line via: npm <command> --key=value
More configuration info: npm help config
Configuration fields: npm help 7 config
npm@10.9.0 /tmp/deno-compile-deno-npm/bin/node_modules/.deno/npm@10.9.0/node_modules/npm
Remove node_modules, and just be sure remove /tmp/deno-compile-deno-npm/bin/node_modules/.deno/npm@10.9.0/node_modules/npm to see if the standalone executable produced by deno still works as expected.
rm -rf node_modules /tmp/deno-compile-deno-npm/bin/node_modules/.deno/npm@10.9.0/node_modules/npm /tmp/deno-compile-deno-npm
Run the executable again
deno-npm
npm <command>
Usage:
npm install install all the dependencies in your project
npm install <foo> add the <foo> dependency to your project
npm test run this project's tests
npm run <foo> run the script named <foo>
npm <command> -h quick help on <command>
npm -l display usage info for all commands
npm help <term> search for help on <term>
npm help npm more involved overview
All commands:
access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
help-search, hook, init, install, install-ci-test,
install-test, link, ll, login, logout, ls, org, outdated,
owner, pack, ping, pkg, prefix, profile, prune, publish,
query, rebuild, repo, restart, root, run-script, sbom,
search, set, shrinkwrap, star, stars, start, stop, team,
test, token, uninstall, unpublish, unstar, update, version,
view, whoami
Specify configs in the ini-formatted file:
/home/user/.npmrc
or on the command line via: npm <command> --key=value
More configuration info: npm help config
Configuration fields: npm help 7 config
npm@10.9.0 /tmp/deno-compile-deno-npm/bin/node_modules/.deno/npm@10.9.0/node_modules/npm
The standalone executable produced by deno compile still works.
What version of Bun is running?
1.1.31-canary.58
What platform is your computer?
Linux 5.15.0-43-generic x86_64 x86_64 (7283453)
What steps can reproduce the bug?
Run the executable without removing the
nodule_modulesdirectory, works as expected.Remove the
node_modulesfolderWhat is the expected behavior?
The standalone executable shoule be standalone, without looking for the module source files of the executable on the machine.
What do you see instead?
Run the executable again, without
node_modulesdirectory on the machine, and the executable does not work as expected. Can't find a module innode_modulesthat doesn't exist.Additional information
Compare compiling to a standalone executable with Deno
Run the executable to make sure it works
Remove
node_modules, and just be sure remove/tmp/deno-compile-deno-npm/bin/node_modules/.deno/npm@10.9.0/node_modules/npmto see if the standalone executable produced bydenostill works as expected.Run the executable again
The standalone executable produced by
deno compilestill works.