Skip to content

ERROR Error: Command failed: npx yarn --prod #775

@itsananderson

Description

@itsananderson

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions