Homebrew: Using Yarn and Node.js LTS
Node.js released v10, last week. Vanilla has some dependencies that haven't quite caught up to this version. Attempting to build with Vanilla CLI while running Node.js > 9 will likely result in a fatal error. It is necessary to rollback the Node.js version, until Vanilla's dependencies are compatible with v10.
If you installed Node.js with Homebrew and have updated your packages in the past week, chances are you're using v10. Getting back to a supported version isn't that difficult.
If you installed Yarn with Homebrew, uninstall it. Yarn is likely dependent on Node.js, so you can't uninstall it without uninstalling Yarn, first.
brew uninstall yarn
Hopefully that's all the dependencies. Now, uninstall Node.js.
brew uninstall node
Re-install Node.js at v8. This is the current LTS version (reaches EOL in Dec '19).
brew install node@8
Re-install Yarn without its Node.js dependency. The default package install would also attempt to install the latest and greatest version of Node.js on your system, which would be counter-productive.
brew install yarn --without-node
Since Homebrew installed an older version of Node.js, it isn't going to automatically be wired up in your path to use. If you want to be able to use the v8 executables, you'll want to add the v8 bin directory to your path.
fish shell
set -g fish_user_paths (brew --prefix node@8)"/bin" $fish_user_paths
Lastly, reinstalling Vanilla CLI's Node.js modules may be necessary .
vanilla build --reinitialize
Comments
-
My experience with Node is that companies should try to stick to the most recent Long Term Release (LTS) version of node for day-to-day dev work and production. Release schedule can be found here:
https://github.com/nodejs/Release
What is the policy at Vanilla regarding what version of node to install?
- do we need features found in Node v9 or v10?
- do the libraries/npm packages we leverage work on v9 or v10?
1 -
@chrisdepage The upcoming release will be the first with our new Javascript build in place, so now is exactly the time to figure that out and (soon) document it. I suggest sitting with @charrondev to work that out if he hasn't yet. The docs are waiting on final decisions like those before Adam commits them and formalizes our new build process publicly.
0 -
I guess I hadn't made it very apparent, but until now the build tool has required a minimum node version of 8.3. Ideally we will support only the current LTS release of node with it, which at the moment is 8 and will be 10 at the end of the year.
As far features, go we aren't using anything from 9 that isn't present in 8. I'll be sure to make version requirements quite clear when we polish it up for the 2.7 release.
1 -
@charrondev if we move to using yarn it does respect the "engines" property in the package.json file. If we stick with npm putting this value in the package.json file is still the expected place for such documentation.
1 -
We already use yarn for everything.
0