Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: "No loader is configured for ".bak" files:" exception when running install-dependencies.sh twice #1270

Open
3 tasks done
KoStard opened this issue May 11, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@KoStard
Copy link

KoStard commented May 11, 2024

Before submitting your bug report

Relevant environment info

- OS: MacOS 14.4.1 (23E224)
- Continue: git clone
- IDE:VSCode

Description

When setting up the local dev environment, if you run the install-dependencies.sh command twice, you get an error.

Manual mitigation

cd binary/
rm -rf node_modules/
npm install
npm run build

To reproduce

git clone https://github.com/continuedev/continue
./install-dependencies.sh
./install-dependencies.sh

or

git clone https://github.com/continuedev/continue
./install-dependencies.sh
cd binary/
npm install
npm run build

Log output

[info] Building with esbuild...
✘ [ERROR] No loader is configured for ".bak" files: node_modules/win-ca/lib/crypt32-x64.node.bak

    node_modules/win-ca/lib/n-api.js:3:18:
      3 │ crypt32 = require("./crypt32-" + process.arch);~~~~~~~~~~~~

✘ [ERROR] No loader is configured for ".bak" files: node_modules/win-ca/lib/crypt32-ia32.node.bak

    node_modules/win-ca/lib/n-api.js:3:18:
      3 │ crypt32 = require("./crypt32-" + process.arch);~~~~~~~~~~~~

/Users/kostard/personal/continue/binary/node_modules/esbuild/lib/main.js:1651
  let error = new Error(text);
              ^

Error: Build failed with 2 errors:
node_modules/win-ca/lib/n-api.js:3:18: ERROR: No loader is configured for ".bak" files: node_modules/win-ca/lib/crypt32-ia32.node.bak
node_modules/win-ca/lib/n-api.js:3:18: ERROR: No loader is configured for ".bak" files: node_modules/win-ca/lib/crypt32-x64.node.bak
    at failureErrorWithLog (/Users/kostard/personal/continue/binary/node_modules/esbuild/lib/main.js:1651:15)
    at /Users/kostard/personal/continue/binary/node_modules/esbuild/lib/main.js:1059:25
    at /Users/kostard/personal/continue/binary/node_modules/esbuild/lib/main.js:1004:52
    at buildResponseToResult (/Users/kostard/personal/continue/binary/node_modules/esbuild/lib/main.js:1057:7)
    at /Users/kostard/personal/continue/binary/node_modules/esbuild/lib/main.js:1086:16
    at responseCallbacks.<computed> (/Users/kostard/personal/continue/binary/node_modules/esbuild/lib/main.js:704:9)
    at handleIncomingPacket (/Users/kostard/personal/continue/binary/node_modules/esbuild/lib/main.js:764:9)
    at Socket.readFromStdout (/Users/kostard/personal/continue/binary/node_modules/esbuild/lib/main.js:680:7)
    at Socket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v20.11.0
@KoStard KoStard added the bug Something isn't working label May 11, 2024
@sestinj sestinj self-assigned this May 13, 2024
@fernandosanchezjr
Copy link
Contributor

Hello!

I have narrowed down generation of .bak files to the cross platform binary builds for windows here. The following pkg invocations cause the issue:

  • npx pkg --no-bytecode --public-packages "*" --public pkgJson/win32-x64 --out-path bin/win32-x64
  • npx pkg --no-bytecode --public-packages "*" --public pkgJson/win32-arm64 --out-path bin/win32-arm64

After these calls to pkg, some .node files will be copied into .node.bak files due to the following code in vercel/pkg:

  // prebuild-install will overwrite the target .node file, so take a backup
  if (!fs.existsSync(`${nodeFile}.bak`)) {
    fs.copyFileSync(nodeFile, `${nodeFile}.bak`);
  }

A subsequent run of the build script will fail when invoking esbuild here.

A possible solution would be to delete the problem .node.bak files before invoking esbuild. I have created a pull request with the changes here: #1287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants