ERROR Error: Command failed: npx yarn --prod
This is a placeholder issue meant to provide instructions for anyone who encounters this error during the build-tools self-update process.
When build-tools updates itself, it first does a git pull and then a yarn install. Unfortunately, with our recent migration to Yarn 4 this causes an issue, because the old code runs npx yarn --prod, which in this case causes the following error:
Running "npx yarn --prod" in C:\Users\itsananderson\.electron_build_tools
ERROR Error: Command failed: npx yarn --prod
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at checkExecSyncError (node:child_process:891:11)
at Object.execSync (node:child_process:963:15)
at Command.checkForUpdates (C:\Users\itsananderson\.electron_build_tools\src\e-auto-update.js:126:10)
at Command.listener [as _actionHandler] (C:\Users\itsananderson\.electron_build_tools\node_modules\commander\lib\command.js:480:17)
at C:\Users\itsananderson\.electron_build_tools\node_modules\commander\lib\command.js:1234:65
at Command._chainOrCall (C:\Users\itsananderson\.electron_build_tools\node_modules\commander\lib\command.js:1151:12)
at Command._parseCommand (C:\Users\itsananderson\.electron_build_tools\node_modules\commander\lib\command.js:1234:27)
at Command.parse (C:\Users\itsananderson\.electron_build_tools\node_modules\commander\lib\command.js:889:10)
This happens because Yarn 4 does not accept a --prod parameter. After the upgrade, the new build-tools code instead runs yarn install --immutable which is supported by Yarn 4.
To fix this error, you can use the following commands to manually run the Yarn install:
cd ~/.electron_build_tools
yarn install --immutable
Quick note if anyone else runs into it. My yarn install --immutable failed with:
PS C:\Users\nikwen\.electron_build_tools> yarn install --immutable
➤ YN0000: · Yarn 4.10.3
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 253ms
➤ YN0000: ┌ Link step
➤ YN0007: │ sqlite3@npm:5.1.7 [68fd2] must be built because it never has been before or the last one failed
➤ YN0009: │ sqlite3@npm:5.1.7 [68fd2] couldn't be built successfully (exit code 1, logs can be found here: C:\Users\nikwen\AppData\Local\Temp\xfs-aee79d3a\build.log)
➤ YN0000: └ Completed in 5s 987ms
➤ YN0000: · Failed with errors in 6s 348ms
The solution was:
pip install setuptools