diff --git a/binary/build.js b/binary/build.js index 1ebc4b196..cf8a2420b 100644 --- a/binary/build.js +++ b/binary/build.js @@ -238,17 +238,16 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { }.tar.gz`; execCmdSync(`curl -L -o ${targetDir}/build.tar.gz ${downloadUrl}`); execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`); - fs.copyFileSync( - `${targetDir}/build/Release/node_sqlite3.node`, - `${targetDir}/node_sqlite3.node`, - ); + + // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found + fs.writeFileSync(`${targetDir}/package.json`, ""); // Copy to build directory for testing try { const [platform, arch] = target.split("-"); if (platform === currentPlatform && arch === currentArch) { fs.copyFileSync( - `${targetDir}/node_sqlite3.node`, + `${targetDir}/build/Release/node_sqlite3.node`, `build/node_sqlite3.node`, ); } @@ -258,10 +257,6 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { } fs.unlinkSync(`${targetDir}/build.tar.gz`); - fs.rmSync(`${targetDir}/build`, { - recursive: true, - force: true, - }); // Download and unzip prebuilt esbuild binary for the target console.log(`[info] Downloading esbuild for ${target}...`); @@ -300,7 +295,8 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { `${targetDir}/continue-binary${exe}`, `${targetDir}/esbuild${exe}`, `${targetDir}/index.node`, // @lancedb - `${targetDir}/node_sqlite3.node`, + "package.json", // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found + `${targetDir}/build/Release/node_sqlite3.node`, ); }