oven-sh/bun

Error when importing ```findPackageJSON``` method from ```node:module```

开放

#23,898 创建于 2025年10月21日

 (10 条评论) (4 个反应) (0 位负责人)Rust (4,486 个派生)batch import
bugconfirmed buggood first issuenode:module

仓库指标

星标
 (90,348 个星标)
PR 合并指标
 (平均合并 1天 17小时) (30 天内合并 357 个 PR)

描述

What version of Bun is running?

1.3.0+b0a6feca5

What platform is your computer?

Linux 6.8.0-85-generic x86_64 x86_64

What steps can reproduce the bug?

  1. create a file test.mjs with the following content:
import { findPackageJSON } from 'node:module';

findPackageJSON(import.meta.resolve('lodash'));
  1. run it like bun test.mjs

What is the expected behavior?

It should give no output, since the above does not throw a SyntaxError in Node.js.

What do you see instead?

SyntaxError: Export named 'findPackageJSON' not found in module 'node:module'.
      at loadAndEvaluateModule (2:1)

Additional information

The method findPackageJSON is not tied to any missing feature listed in bun documentation, in regards of node:module.

贡献者指南