Skip to content

Incompatibility with Node.js v22.12.0: ReferenceError: require is not defined (But Works with v22.11.0) #56155

@Vanakeethan

Description

@Vanakeethan

Version

node v22.12.0(LTS)

Platform

Windows 11 23H2, 64-bit
Node.js v22.12.0

What steps will reproduce the bug?

  1. Install Node.js v22.12.0.
  2. Clone the repository.
  3. Run npm install.
  4. Run npm run dev.

How often does it reproduce? Is there a required condition?

The issue consistently reproduces every time the application is run using Node.js v22.12.0.

What is the expected behavior? Why is that the expected behavior?

The application should start without any errors.

What do you see instead?

The application fails with the error:
ReferenceError: require is not defined

const path = require("path");
^
ReferenceError: require is not defined
at file:///path/to/tailwind.config.js:1:14

Additional information

**### ## Compatibility

Node.js Compatibility

  • This project is currently incompatible with Node.js v22.12.0 due to stricter module handling.
    - Use Node.js v22.11.0 for a stable experience.

Workaround

To run the project successfully:

  1. Install Node.js v22.11.0:
    nvm install 22.11.0
    nvm use 22.11.0 
    

Download the Node.js v22.11.0 for a stable experience.

https://drive.google.com/file/d/1fjLXb1xUMowMj3F9FmDt1dw0XJOuYflP/view?usp=sharing

Metadata

Metadata

Assignees

No one assigned

    Labels

    loadersIssues and PRs related to ES module loadersmoduleIssues and PRs related to the module subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions