Skip to content

youtube-dl-exec Fails to Install on macOS M1 Silicon Due to Postinstall Script Error #227

Closed
@izzetemredemir

Description

Description:
The youtube-dl-exec package fails to install on macOS M1 Silicon using both npm and pnpm. The error occurs during the postinstall script.

Environment:

  • Device: MacBook with M1 Silicon (Apple Silicon)
  • Operating System: macOS
  • Node.js Version: v20.7.0
  • npm Version: 10.2.4
  • youtube-dl-exec Version: 3.0.9 and 3.0.10 and 3.0.12

Steps to Reproduce:

  1. Initialize a new Node.js project:
    mkdir test-project
    cd test-project
    npm init -y  # or pnpm init -y
  2. Install the package:
    npm install youtube-dl-exec
    # or
    pnpm add youtube-dl-exec

Expected Behavior:
The package should install without any errors.

Actual Behavior:
The installation fails with the following error:

npm ERR! code 1
npm ERR! path /[project-path]/node_modules/youtube-dl-exec
npm ERR! command failed
npm ERR! command sh -c node scripts/postinstall.js
npm ERR! /[project-path]/node_modules/youtube-dl-exec/scripts/postinstall.js:17
npm ERR!   const { browser_download_url: url } = assets.find(
npm ERR!                                                ^
npm ERR! 
npm ERR! TypeError: Cannot read properties of undefined (reading 'find')
npm ERR!     at getLatest (/[project-path]/node_modules/youtube-dl-exec/scripts/postinstall.js:17:48)
npm ERR!     at getBinary (/[project-path]/node_modules/youtube-dl-exec/scripts/postinstall.js:26:22)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm ERR!     at async Promise.all (index 0)
npm ERR!     at async installBinary (/[project-path]/node_modules/youtube-dl-exec/scripts/postinstall.js:33:20)
npm ERR! 
npm ERR! Node.js v20.7.0

npm ERR! A complete log of this run can be found in: /[user-home]/.npm/_logs/2025-01-15T10_54_47_345Z-debug-0.log

Additional Notes:

  • The issue occurs with both npm and pnpm.
  • Tried using --ignore-scripts, but the issue persists.
  • shamefully-hoist and cache clearing didn’t resolve the problem.
  • The error seems related to the assets variable being undefined in the postinstall.js.

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