Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bun install error [ERR_REQUIRE_ESM]: Must use import to load ES Module #145

Open
rsholmes opened this issue Feb 18, 2025 · 6 comments
Open
Labels
linux Platform: Linux

Comments

@rsholmes
Copy link

rsholmes commented Feb 18, 2025

bun install throws an error:

bun install v1.2.2 (c1708ea6)
  🚚 pnpm... internal/modules/cjs/loader.js:1025
  throw new ERR_REQUIRE_ESM(filename);
  ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/rsholmes/Downloads/amazon-kindle-bulk-downloader-main/node_modules/puppeteer/install.mjs
    at Object.Module._extensions..mjs (internal/modules/cjs/loader.js:1025:9)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'ERR_REQUIRE_ESM'
}

error: postinstall script from "puppeteer" exited with 1

Using Linux Mint 21.3.

@sean808080
Copy link

I just tried
bun install https://github.com/treetrum/amazon-kindle-bulk-downloader

It looks like it worked?

@sean808080
Copy link

sean808080 commented Feb 19, 2025

Got it working...a bit of hacking needed. This is on my Mac....

  1. bun install https://github.com/treetrum/amazon-kindle-bulk-downloader
  2. I changed the directory to the path of the project on my mac
    (/Users/sean/node_modules/amazon-kindle-bulk-downloader)
  3. I hard coded my username and pwd in the credentials.ts file bec. I didn't have time to figure out the env config setup. I gotta get to work!
  4. I ran --> bun run start --baseUrl "https://www.amazon.com"
  5. I selected the oldest kindle on my account and bam...it found over 500 books and downloaded them into a subdirectory called 'Downloads"

I'm not sure why my other kindles said 0 books found but it worked so thanks to the author.

@rsholmes
Copy link
Author

I just tried bun install https://github.com/treetrum/amazon-kindle-bulk-downloader

It looks like it worked?

That gives exactly the same error:

$ bun install https://github.com/treetrum/amazon-kindle-bulk-downloader
bun add v1.2.2 (c1708ea6)
  ⚙️  puppeteer [1/1] internal/modules/cjs/loader.js:1025
  throw new ERR_REQUIRE_ESM(filename);
  ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/rsholmes/Downloads/akbd/node_modules/puppeteer/install.mjs
    at Object.Module._extensions..mjs (internal/modules/cjs/loader.js:1025:9)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'ERR_REQUIRE_ESM'
}

error: postinstall script from "puppeteer" exited with 1

System info:

System:
  Kernel: 5.15.0-131-generic x86_64 bits: 64 compiler: gcc v: 11.4.0 Desktop: Cinnamon 6.0.4
    tk: GTK 3.24.33 wm: muffin vt: 7 dm: LightDM 1.30.0 Distro: Linux Mint 21.3 Virginia
    base: Ubuntu 22.04 jammy
Machine:
  Type: Desktop System: System76 product: Wild Dog Pro v: wilp14 serial: <superuser required>
    Chassis: type: 3 v: wilp14 serial: <superuser required>
  Mobo: Gigabyte model: Z370 HD3P-CF v: x.x serial: <superuser required>
    UEFI: American Megatrends v: F5 Z5 date: 12/15/2017
CPU:
  Info: 6-core model: Intel Core i5-8400 bits: 64 type: MCP smt: <unsupported> arch: Coffee Lake
    rev: A cache: L1: 384 KiB L2: 1.5 MiB L3: 9 MiB
  Speed (MHz): avg: 904 high: 1428 min/max: 800/4000 cores: 1: 800 2: 800 3: 800 4: 800 5: 800
    6: 1428 bogomips: 33599
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel CoffeeLake-S GT2 [UHD Graphics 630] vendor: Gigabyte CometLake-S driver: i915
    v: kernel ports: active: HDMI-A-1 empty: DP-1,HDMI-A-2,HDMI-A-3 bus-ID: 00:02.0
    chip-ID: 8086:3e92 class-ID: 0300
  Device-2: Logitech HD Pro Webcam C920 type: USB driver: snd-usb-audio,uvcvideo
    bus-ID: 1-8.4:10 chip-ID: 046d:082d class-ID: 0102 serial: <filter>
  Display: x11 server: X.Org v: 1.21.1.4 driver: X: loaded: modesetting unloaded: fbdev,vesa
    gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") s-diag: 582mm (22.9")
  Monitor-1: HDMI-1 mapped: HDMI-A-1 model: Dell S2715H serial: <filter> res: 1920x1080 hz: 60
    dpi: 82 size: 598x336mm (23.5x13.2") diag: 686mm (27") modes: max: 1920x1080 min: 720x400
  OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 23.2.1-1ubuntu3.1~22.04.3
    direct render: Yes
Audio:
  Device-1: Intel 200 Series PCH HD Audio vendor: Gigabyte driver: snd_hda_intel v: kernel
    bus-ID: 00:1f.3 chip-ID: 8086:a2f0 class-ID: 0403
  Device-2: Logitech HD Pro Webcam C920 type: USB driver: snd-usb-audio,uvcvideo
    bus-ID: 1-8.4:10 chip-ID: 046d:082d class-ID: 0102 serial: <filter>
  Sound Server-1: ALSA v: k5.15.0-131-generic running: yes
  Sound Server-2: JACK v: 1.9.20 running: no
  Sound Server-3: PulseAudio v: 15.99.1 running: yes
  Sound Server-4: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Intel Ethernet I219-V vendor: Gigabyte driver: e1000e v: kernel port: N/A
    bus-ID: 00:1f.6 chip-ID: 8086:15b8 class-ID: 0200
  IF: enp0s31f6 state: down mac: <filter>
  Device-2: Intel Wireless 8260 driver: N/A pcie: speed: 2.5 GT/s lanes: 1 bus-ID: 08:00.0
    chip-ID: 8086:24f3 class-ID: 0280
  Device-3: Ralink RT5572 Wireless Adapter type: USB driver: rt2800usb bus-ID: 1-11:5
    chip-ID: 148f:5572 class-ID: 0000 serial: <filter>
  IF: wlx9cefd5fdd05e state: up mac: <filter>
  IF-ID-1: virbr0 state: down mac: <filter>
Bluetooth:
  Device-1: Intel Bluetooth wireless interface type: USB driver: btusb v: 0.8 bus-ID: 1-14:9
    chip-ID: 8087:0a2b class-ID: e001
  Report: hciconfig ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 2.1 lmp-v: 4.2
    sub-v: 100 hci-v: 4.2 rev: 100
Drives:
  Local Storage: total: 2.27 TiB used: 1.56 TiB (68.7%)
  ID-1: /dev/sda vendor: Samsung model: SSD 850 EVO M.2 500GB size: 465.76 GiB speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: 1B6Q scheme: GPT
  ID-2: /dev/sdb type: USB vendor: Western Digital model: WD My Passport 25E2 size: 1.82 TiB
    type: N/A serial: <filter> rev: 4005 scheme: MBR
Partition:
  ID-1: / size: 456.89 GiB used: 288.86 GiB (63.2%) fs: ext4 dev: /dev/sda2
  ID-2: /boot/efi size: 511 MiB used: 6.1 MiB (1.2%) fs: vfat dev: /dev/sda1
Swap:
  ID-1: swap-1 type: file size: 12 GiB used: 4.63 GiB (38.5%) priority: -2 file: /swapfile
USB:
  Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 16 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-2: 1-8:2 info: VIA Labs VL813 Hub ports: 4 rev: 2.1 speed: 480 Mb/s chip-ID: 2109:2813
    class-ID: 0900
  Device-1: 1-8.2:4 info: Logitech Keyboard K120 type: Keyboard,HID driver: hid-generic,usbhid
    interfaces: 2 rev: 1.1 speed: 1.5 Mb/s power: 90mA chip-ID: 046d:c31c class-ID: 0300
  Device-2: 1-8.4:10 info: Logitech HD Pro Webcam C920 type: Video,Audio
    driver: snd-usb-audio,uvcvideo interfaces: 4 rev: 2.0 speed: 480 Mb/s power: 500mA
    chip-ID: 046d:082d class-ID: 0102 serial: <filter>
  Hub-3: 1-9:3 info: Terminus FE 2.1 7-port Hub ports: 7 rev: 2.0 speed: 480 Mb/s power: 100mA
    chip-ID: 1a40:0201 class-ID: 0900
  Device-1: 1-9.5:6 info: Razer USA Pro Click type: Mouse,Keyboard driver: hid-generic,usbhid
    interfaces: 3 rev: 2.0 speed: 12 Mb/s power: 500mA chip-ID: 1532:0077 class-ID: 0300
  Device-2: 1-11:5 info: Ralink RT5572 Wireless Adapter type: Network driver: rt2800usb
    interfaces: 1 rev: 2.0 speed: 480 Mb/s power: 450mA chip-ID: 148f:5572 class-ID: 0000
    serial: <filter>
  Device-3: 1-12:8 info: Alcor Micro Flash Card Reader/Writer type: Mass Storage
    driver: usb-storage interfaces: 1 rev: 2.0 speed: 480 Mb/s power: 250mA chip-ID: 058f:6362
    class-ID: 0806 serial: <filter>
  Device-4: 1-14:9 info: Intel Bluetooth wireless interface type: Bluetooth driver: btusb
    interfaces: 2 rev: 2.0 speed: 12 Mb/s power: 100mA chip-ID: 8087:0a2b class-ID: e001
  Hub-4: 2-0:1 info: Super-speed hub ports: 10 rev: 3.0 speed: 5 Gb/s chip-ID: 1d6b:0003
    class-ID: 0900
  Device-1: 2-3:2 info: Western Digital My Passport (WD40NMZW) type: Mass Storage
    driver: usb-storage interfaces: 1 rev: 3.1 speed: 5 Gb/s power: 896mA chip-ID: 1058:25e2
    class-ID: 0806 serial: <filter>
  Hub-5: 2-8:3 info: VIA Labs VL813 Hub ports: 4 rev: 3.0 speed: 5 Gb/s chip-ID: 2109:0813
    class-ID: 0900
  Hub-6: 3-0:1 info: Hi-speed hub with single TT ports: 2 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-7: 4-0:1 info: Super-speed hub ports: 2 rev: 3.1 speed: 10 Gb/s chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-8: 5-0:1 info: Hi-speed hub with single TT ports: 4 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-9: 6-0:1 info: Super-speed hub ports: 4 rev: 3.0 speed: 5 Gb/s chip-ID: 1d6b:0003
    class-ID: 0900
Sensors:
  System Temperatures: cpu: 27.8 C mobo: 16.8 C
  Fan Speeds (RPM): N/A
Repos:
  Packages: 4022 apt: 3926 nix-default: 48 flatpak: 40 snap: 8
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/antiprism-ppa-jammy.list
    1: deb http: //ppa.launchpad.net/antiprism/ppa/ubuntu jammy main
  No active apt repos in: /etc/apt/sources.list.d/appimagelauncher-team-stable-jammy.list
  No active apt repos in: /etc/apt/sources.list.d/bit-team-stable-jammy.list
  No active apt repos in: /etc/apt/sources.list.d/celestia-bintray.list
  No active apt repos in: /etc/apt/sources.list.d/gencfsm-ppa-jammy.list
  Active apt repos in: /etc/apt/sources.list.d/gierens.list
    1: deb http: //deb.gierens.de stable main
  Active apt repos in: /etc/apt/sources.list.d/git-core-ppa-jammy.list
    1: deb http: //ppa.launchpad.net/git-core/ppa/ubuntu jammy main
  Active apt repos in: /etc/apt/sources.list.d/inkscape_dev-stable-jammy.list
    1: deb [signed-by=/etc/apt/keyrings/inkscape_dev-stable-jammy.gpg] https: //ppa.launchpadcontent.net/inkscape.dev/stable/ubuntu jammy main
  Active apt repos in: /etc/apt/sources.list.d/josm.list
    1: deb [signed-by=/usr/local/share/keyrings/josm-apt.gpg] https: //josm.openstreetmap.de/apt jammy universe
  Active apt repos in: /etc/apt/sources.list.d/kdenlive-kdenlive-stable-jammy.list
    1: deb http: //ppa.launchpad.net/kdenlive/kdenlive-stable/ubuntu jammy main
  Active apt repos in: /etc/apt/sources.list.d/kicad-kicad-8_0-releases-jammy.list
    1: deb [signed-by=/etc/apt/keyrings/kicad-kicad-8_0-releases-jammy.gpg] https: //ppa.launchpadcontent.net/kicad/kicad-8.0-releases/ubuntu jammy main
  Active apt repos in: /etc/apt/sources.list.d/kicad-kicad-dev-nightly-jammy.list
    1: deb http: //ppa.launchpad.net/kicad/kicad-dev-nightly/ubuntu jammy main
  Active apt repos in: /etc/apt/sources.list.d/libreoffice-ppa-jammy.list
    1: deb [arch=amd64 signed-by=/etc/apt/keyrings/libreoffice-ppa-jammy.gpg] https: //ppa.launchpadcontent.net/libreoffice/ppa/ubuntu jammy main
  No active apt repos in: /etc/apt/sources.list.d/mozilla.list
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
    1: deb http: //packages.linuxmint.com virginia main upstream import backport
    2: deb http: //archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
    3: deb http: //archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
    4: deb http: //archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
    5: deb http: //security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
  Active apt repos in: /etc/apt/sources.list.d/protonvpn-stable.list
    1: deb [signed-by=/usr/share/keyrings/protonvpn-stable-archive-keyring.gpg] https: //repo.protonvpn.com/debian stable main
  Active apt repos in: /etc/apt/sources.list.d/sane-project-sane-git-jammy.list
    1: deb [signed-by=/etc/apt/keyrings/sane-project-sane-git-jammy.gpg] https: //ppa.launchpadcontent.net/sane-project/sane-git/ubuntu jammy main
  Active apt repos in: /etc/apt/sources.list.d/slgobinath-gcalendar-jammy.list
    1: deb http: //ppa.launchpad.net/slgobinath/gcalendar/ubuntu jammy main
  No nix channels found for user: rsholmes
Info:
  Processes: 374 Uptime: 2d 44m wakeups: 0 Memory: 23.34 GiB used: 14.18 GiB (60.7%) Init: systemd
  v: 249 runlevel: 5 Compilers: gcc: 11.4.0 alt: 11/12/9 Client: Cinnamon v: 6.0.4 inxi: 3.3.13

@rsholmes
Copy link
Author

I just tried bun install https://github.com/treetrum/amazon-kindle-bulk-downloader

It looks like it worked?

That gives me the error mentioned here. In addition, when I try that command in Arch Linux or in a fresh copy of Linux Mint 22.1 on a USB stick, I don't get that error but I get another one. But downloading the repo zip, extracting it, and doing bun install in that directory does work in Arch.

So no, I don't think that command is what should be used.

@inlikealion
Copy link
Collaborator

@rsholmes what I’m seeing in your report is actually not on install but on the post install puppeteer script.

It should be bun install inside the project directory, not the command with the repo url appended, AFAIK. If you are still getting the original error, I would suggest ensuring puppeteer and its chrome engine are installed correctly for your system.

@rsholmes
Copy link
Author

rsholmes commented Feb 20, 2025

Yes, I'm doing bun install in the project directory.

I don't know anything about puppeteer, but I assume it is something included as part of this package; in the node_modules directory are subdirectories @puppeteer, puppeteer, and puppeteer_core. If these are incorrectly configured then that presumably is an installation fault. But I have no idea how to check whether they are correct. Is it possible there is some other, incompatible, version of puppeteer installed elsewhere taking precedence? But that seems unlikely since the error message specifically calls out /home/rsholmes/Downloads/amazon-kindle-bulk-downloader-main/node_modules/puppeteer/install.mjs.

@inlikealion inlikealion added the linux Platform: Linux label Feb 20, 2025
@rsholmes rsholmes changed the title bun install error bun install error [ERR_REQUIRE_ESM]: Must use import to load ES Module Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux Platform: Linux
Projects
None yet
Development

No branches or pull requests

3 participants