# install volta via: https://volta.sh/ ❯ volta pin node success: pinned email@example.com (with firstname.lastname@example.org) in package.json ❯ volta pin yarn success: pinned email@example.com in package.json
And from now on every environment that has volta installed respective versions of node and yarn will be used. Automatically, no manual switching necessary.
Unfortunately my favourite frontend hosting service - Netlify does not support volta out of the box. Which I found the hard way after a project update. Although it compiled fine on localhost, it refused to work with the default version of node on netlify.
After a little bit of googling I found an-OK solution in Netlify file based configuration. The file
netlify.toml goes to the root of your repo:
# netlify.toml [build.environment] NODE_VERSION = "14.15.4" YARN_VERSION = "1.22.5"
- Different (major) versions of node can be incompatible and code running fine under one might fail to build under other.
- If you want to pin node and yarn version for netlify, use