DEV Community

alphokung
alphokung

Posted on

แก้ปัญหา Build NUXT 2.15.x บน node:lts ด้วย docker ไม่ได้

ช่วงนี้ได้เข้ามาช่วยทีมย้ายระบบที่เขียนด้วย Nuxt 2.15 แล้วเจอว่ามี bug บางอย่างที่ต้องทำการแก้ แต่พอแก้เสร็จดันเจอว่ามี error ที่ไม่เคยเจอเกิดขึ้น

Image description

หลังจากลองหาข้อมูลเลยถึงบางอ้อว่า ตอนนี้ Node17+ มันมีการปรับ Hash algorithm เลยทำให้ไม่สามารถรันได้ จำเป็นจะต้องเพิ่ม NODE_OPTIONS=--openssl-legacy-providerเข้าไปก่อนสั่ง yarn build

สรุปคือเติมประมาณนี้ใน Dockerfile ก็เรียบร้อยแล้ว

ENV NODE_OPTIONS=--openssl-legacy-provider
RUN yarn build
Enter fullscreen mode Exit fullscreen mode

Happy coding ครับ

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay