DEV Community

Chris
Chris

Posted on

2 1

Fix NX Node executor ERR_REQUIRE_ESM Error

昨晚睡前踩了個雷,來分享一下:

NX 新專案忘了裡面已經裝過 nanoid,重裝了一次,然後 @nrwl/node:node 就開始報錯,找到引用 nanoid 的 model,在 sequelize hooks 裡,用報錯的解法改用 dynamic import 可以解決,查 NX issue 也看到幾個 node executor 不支援 static import ESM 的問題。

然後剛剛去看 nanoid,3 天前 nanoid@4 migrate 到純 ESM 不支援 CJS 了⋯⋯降級回 nanoid@3 就解決了,等 NX issue #10414 merge 看有沒有改善吧。

Reference

Top comments (0)

Tiger Data image

🐯 🚀 Timescale is now TigerData: Building the Modern PostgreSQL for the Analytical and Agentic Era

We’ve quietly evolved from a time-series database into the modern PostgreSQL for today’s and tomorrow’s computing, built for performance, scale, and the agentic future.

So we’re changing our name: from Timescale to TigerData. Not to change who we are, but to reflect who we’ve become. TigerData is bold, fast, and built to power the next era of software.

Read more

👋 Kindness is contagious

Explore this compelling article, highly praised by the collaborative DEV Community. All developers, whether just starting out or already experienced, are invited to share insights and grow our collective expertise.

A quick “thank you” can lift someone’s spirits—drop your kudos in the comments!

On DEV, sharing experiences sparks innovation and strengthens our connections. If this post resonated with you, a brief note of appreciation goes a long way.

Get Started