Skip to content

bug(node): npm run build:release fails due to missing file in postbuild:release #3284

Description

@qingfeng-occ

LanceDB version

v0.27.2

What happened?

📋 Description

When attempting to run npm run build:release in the nodejs directory, the build process fails during the postbuild:release hook. The error indicates that the source file for the copy command cannot be found.

ℹ️ Environment

  • OS: Linux
  • Node.js Version: v22.22.2

📝 Steps to Reproduce

  1. Navigate to the nodejs directory.
  2. Run the command: npm run build:release

❌ Error Log

> @lancedb/[email protected] postbuild:release
> shx mkdir -p dist && shx cp lancedb/*.node dist/

cp: no such file or directory: lancedb/*.node

🔍 Analysis

I have analyzed the scripts defined in package.json:

  • build:release: "napi build --platform --release --dts ../lancedb/native.d.ts --js ../lancedb/native.js --output-dir dist"
  • postbuild:release: "shx mkdir -p dist && shx cp lancedb/*.node dist/"

Root Cause:
The build:release command uses the flag --output-dir dist, which correctly generates the lancedb.*.node files directly into the dist/ directory. Consequently, the lancedb/ source directory does not contain any *.node files.

When the postbuild:release script attempts to execute cp lancedb/*.node dist/, it fails because the source files do not exist in the lancedb/ folder.

💡 Proposed Solution

I suggest fixing this issue using one of the following methods:

  1. Remove the redundant script:
    Simply delete the postbuild:release script from package.json, as the files are already in the correct destination (dist/) after the build.

    OR

  2. Adjust the output directory:
    Modify the build:release script to point the --output-dir parameter to lancedb instead of dist (if the copy step is strictly required for a specific structure).

If there are no objections, I would be happy to open a PR to fix this issue (likely via solution 1).

Are there known steps to reproduce?

See the description above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtypescriptTypescript / javascript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions