node-pqclean icon indicating copy to clipboard operation
node-pqclean copied to clipboard

Package fails to build on install using yarn berry on windows

Open FC5570 opened this issue 1 year ago • 1 comments

I'm not sure whether this is a yarn issue or something related to this package. But building on windows always fails using yarn berry (v4.0.2, v4.0.1, v3.7.0 all tried) using node v20.9.0. However, this does work on legacy versions (v1, tested on v1.22.21).

This issue only occurs on windows and using yarn berry only (npm works fine). Build on linux (debian 10) works fine with yarn stable (v4.0.2).

image

This is the build log:

# This file contains the result of Yarn building a package (pqclean@npm:0.3.1)
# Script name: install

Generated sources exist. To regenerate, please use "npm run regenerate-native".
node:internal/errors:497
    ErrorCaptureStackTrace(err);
    ^

Error: spawn C:\Users\redacted\AppData\Local\Temp\xfs-1546c3d2\node ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\redacted\\AppData\\Local\\Temp\\xfs-1546c3d2\\node',
  path: 'C:\\Users\\redacted\\AppData\\Local\\Temp\\xfs-1546c3d2\\node',
  spawnargs: [
    'C:\\Users\\redacted\\AppData\\Local\\Temp\\xfs-1546c3d2\\yarn',
    'run',
    'build-native'
  ]
}

I've tried running this as admin too.

@tniessen Can you look into this please. Thank you.

FC5570 avatar Nov 17 '23 17:11 FC5570

@FC5570 Thank you for reporting this. It seems that Yarn 4.0.2 sets npm_node_execpath to the path of a temporary #!/bin/sh wrapper for node, and npm_execpath to the path of a temporary #!/bin/sh wrapper for yarn. That breaks install.mjs: npm_node_execpath is not an executable file on Windows, and npm_execpath is not a JavaScript file.

tniessen avatar Nov 20 '23 16:11 tniessen