question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Linux: electron-builder --linux will execute "install --production" instead of "npm install --production"

See original GitHub issue
  • Electron-Builder Version: (latest, installed today)

  • Node Version: 16.9.1

  • Electron Version: 15.3.0 (latest stable)

  • Target: linux (doesn’t matter which target, all targets are affected)

How to reproduce:

  • Use npx electron-builder --linux on ArchLinux, inside a sandbox where electron-builder was installed before, and the electron-builder.json file is used, valid, and works after a manual execution of npm install inside the sandboxed folder.

Where’s the Bug?:

It seems to execute the native install binary (from coreutils) with the --production parameter, which the error message install: unrecognized option '--production' implies as it’s the stderr output of the install binary.

This seems to be caused by the yarn.ts file which relies on environment variables to be set for the npm binary path.

I think that the checks afterwards are broken when there’s no yarn installed and the environment variables aren’t set, as it will lead to the following variables (note that npx was used to execute electron-builder as it wasn’t installed globally).

// inserted a console.log at line 101 in the yarn.js file, which is a tsc generated file so it's hard to debug

execPath = '/usr/bin/node';
execArgs = [
    '/usr/lib/node_modules/npm/bin/npx-cli.js',
    'install',
    '--production',
    '--prefer-offline'
];

Obviously, these parameters are wrong and should not be the case. I’m not sure what all the yarn berry unshift() code is about and why there have to be so many checks when it seems that this is a platform-specific method that should’ve been isolated per-platform as the environment variables are different on each platform.

Anyways, this is the bug, and it’s currently like this for Linux users. I would’ve created a pull request, but I don’t know what to do because the tests don’t seem to cover this, and I don’t have yarn installed and neither other operating systems at hand to test out all the expected branches for all scenarios here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
ReillyBrogancommented, Apr 29, 2022

This shouldn’t be closed. It’s still an issue

1reaction
mmaiettacommented, Nov 19, 2021

I think the npx is being utilized and causing it to run npx rebuild instead of npm rebuild. Can you try npm exec electron-builder --linux?

Read more comments on GitHub >

github_iconTop Results From Across the Web

electron-builder
A complete solution to package and build a ready for distribution Electron app for macOS, Windows and Linux with “auto update” support out...
Read more >
electron-builder - npm
A complete solution to package and build a ready for distribution Electron app for MacOS, Windows and Linux with “auto update” support out ......
Read more >
Npm install command failing with message "could not find ...
When I run the npm install command, npm starts downloading the dependencies. But then, suddenly, it stops with the error:
Read more >
Changelog - Cypress Documentation
Installing Cypress on your system now requires Node.js 14, 16 or 18+. ... Users can now run multiple specs with cypress run in...
Read more >
Electron-builder NPM
Docker images to build Electron app for Linux or Windows on any platform. ... simply add script "postinstall": "electron-builder install-app-deps" to your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found