Skip to content

Version number check fails on Bun #447

@robogeek

Description

@robogeek

I decided to give Bun a try by running the Mocha test suite of one of my packages. The very first failure was in yargs-parser like so:

$ bun run ./node_modules/mocha/bin/mocha.js test-partials.js test-parse.js test-process.js 
986 |     ? Number(process.env.YARGS_MIN_NODE_VERSION)
987 |     : 10;
988 | if (process && process.version) {
989 |     const major = Number(process.version.match(/v([^.]+)/)[1]);
990 |     if (major < minNodeVersion) {
991 |         throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
                  ^
 error: yargs parser supports a minimum Node.js version of 10. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions
      at /home/david/Projects/akasharender/mahabhuta/test/node_modules/yargs-parser/build/index.cjs:991:14
      at bun:wrap:1:16354
      at /home/david/Projects/akasharender/mahabhuta/test/node_modules/mocha/lib/cli/options.js:12:28
      at bun:wrap:1:16354
      at /home/david/Projects/akasharender/mahabhuta/test/node_modules/mocha/bin/mocha.js:13:30

Clearly, Bun isn't going to give a value for process.version that is compatible with Node.js versions. With this script

console.log(process.version);

console.log(process);

I get this output:

$ bun run pv.js 
v0.1.2
{ ... }

For reference: https://github.com/Jarred-Sumner/bun/issues/462

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions