Skip to content

Build from master fails due to ESM-only dependency "is-online" #75

@ldeld

Description

@ldeld

When building the project from the master branch I ran into the following issue:

A JavaScript error occurred in the main process
Uncaught Exception:
Error [ERR_REQUIRE_ESM]: require() of ES Module /tmp/.mount_BandcaAeC6lV/resources/app.asar/node_modules/is-online/index.js from /tmp/.mount_BandcaAeC6lV/resources/app.asar/src/main.js not supported.
Instead change the require of index.js in /tmp/.mount_BandcaAeC6lV/resources/app.asar/src/main.js to a dynamic import() which is available in all CommonJS modules.

Steps to reproduce:

  • clone repo
  • npm install
  • npm start OR build and launch app image

This is because is-online is an ESM only package since version 9.

I found two possible fixes:

  • Downgrade is-online to 8.5.1 (last CJS compatible version)
  • Replace is-online with the esm2cjs version

I think this broke in this PR: https://github.com/themagiulio/bandcamp-desktop/pull/49/files , which upgraded is-online from 8.x to 10.0.
This was merged a few years ago though, so no idea why it still seems to work from most people.

I tested using node 16, 20 and 24 on Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions