Skip to content

Packages calling Module.enableCompileCache produce an error #2128

Description

@donthedeveloper

Describe the bug

After installing the latest version of prettier (currently: 3.9.4), running the command npx prettier . --check in the terminal produces this:

❯ npx prettier . --check
TypeError: Cannot read properties of undefined (reading '0')
    at Module.enableCompileCache (node:internal/modules/helpers:177:2187)
    at Object.eval (/home/projects/stackblitz-starters-qcufpt34/node_modules/prettier/bin/prettier.cjs:61:14)
    at Module._compile (node:internal/modules/cjs/loader:160:19302)
    at Module._extensions..js (node:internal/modules/cjs/loader:160:20043)
    at Module.load (node:internal/modules/cjs/loader:160:17661)
    at Module._load (node:internal/modules/cjs/loader:160:15179)
    at wrapModuleLoad (node:internal/modules/cjs/loader:160:4199)
    at Module.executeUserEntryPoint (node:internal/modules/run_main:179:2179)
    at internal/main/run_main_module (node:internal/main/run_main_module:155:484)

Link to the blitz that caused the error

https://stackblitz.com/edit/stackblitz-starters-qcufpt34?file=package.json

Steps to reproduce

  1. In the blitz terminal, run npx prettier . --check

Expected behavior

Prettier should scan and finish with the results with no problems.

Parity with Local

Screenshots

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: 149.0.7827.201

Additional context

This happens with npx eslint . as well.

A temporary workaround I found is to downgrade packages to versions that don't call enableCompileCache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions