I am working on two project, one which uses node 16 and one which uses node 18. I created a script in one of the projects to switch to 18 before running next dev.
Note: Nvm works in my terminal. I use zsh and installed nvm using homebrew.
The scriptlooks like this:
# Change to correct node version
source $(brew --prefix nvm)/nvm.sh
nvm use 18
# Wait for the database to start
sleep 5
# Start dev with sudo
sudo yarn next dev
However when I run the script with yarn I get: nvm is not compatible with the "PREFIX" environment variable: currently set to "/opt/homebrew" Run `unset PREFIX` to unset it.
I have uninstalled node using brew, it does not help.