How to change my nodejs version

Hey guys, can anyone tell me how to change the Node.js version? My local nvm is already on v20, but when building, the Dockerfile always results in version 18.
No description
2 Replies
kapa.ai
kapa.ai2w ago
Hi @Elliot_bai. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To change the Node.js version for your Wasp project, you need to consider both your local development environment and the Dockerfile settings. Local Development For local development, Wasp currently requires Node.js version 18 or higher. Based on the knowledge sources, Wasp is moving toward supporting newer versions: 1. You mentioned you're using Node.js v20 locally with nvm, which is good news! Wasp has recently updated its requirements to support Node.js >= 18 (not just strictly v18). 2. If you're experiencing any version-related errors locally, you can switch between Node.js versions using nvm:
nvm use 18 # for version 18
nvm use 20 # for version 20

nvm use 18 # for version 18
nvm use 20 # for version 20

Dockerfile Issue Regarding your Dockerfile issue, the knowledge sources indicate that Wasp has been updating its Node.js requirements in Docker images: 1. There was a previous issue about upgrading the Node base image in the Dockerfile from v14 to v16 Change Node base image version in Dockerfile to 16. 2. More recently, Wasp has been working on supporting Node.js 20, as mentioned in several discussions about version requirements Upgrade Node version requirement to 20. If your Dockerfile is still using Node.js 18, you have a few options: 1. Wait for the upcoming Wasp release that will officially support Node.js 20 (mentioned as coming soon in the knowledge sources). 2. Modify the Dockerfile yourself to use Node.js 20 by changing the base image line to something like:
FROM node:20-alpine AS node

FROM node:20-alpine AS node

Note that there was a specific issue with Node.js 20 compatibility related to Web Crypto API polyfill Web Crypto API polyfill breaks Wasp's server when using Node.js 20, but this should be fixed in newer Wasp versions. The Wasp team has indicated they're moving toward a more flexible approach with only a lower limit for Node.js versions, so this situation should improve with upcoming releases. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Elliot_bai, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Carlos
Carlos2w ago
Hey @Elliot_bai, ignore the bot, the correct solution is to upgrade to Wasp v0.16.3 Go into your main.wasp and change the version there Wasp will complain and give you instructions to update itself Wasp v0.16.3 uses Node 20 in its output

Did you find this page helpful?