nestjs / nest-cli

CLI tool for Nest applications 🍹

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERR_REQUIRE_ESM error when trying to import inquirer in Node.js v18.17.0

geetika-iag opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

I recently encountered an issue when running my application with Node.js v18.17.0 using the @nestjs/cli package. Here's the error I received:
It seems the require() function does not support ES modules, which causes this error when trying to require the 'inquirer'
module in 'project-utils.js'. It seems like this might be a compatibility issue with newer versions of Node.js.

I tried upgrading @nestjs/cli to the latest version, but the issue persists.

Environment details:

OS: mac
Node.js version: v18.17.0
NestJS CLI version: v10.1.10

Any help on this issue would be greatly appreciated. Thanks in advance!

Minimum reproduction code

its behind corporate proxy

Steps to reproduce

No response

Expected behavior

it shouldn't error out

Package version

10.1.10

NestJS version

10.0.5

Node.js version

18.17.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

see nestjs/nest#12102

This only happened to me when the lock file was messed up