bullet-train-co / bullet_train

The Open Source Ruby on Rails SaaS Template
MIT License
1.68k stars 269 forks source link

`bin/setup` doesn't tell me how to fix NodeJS version or yarn issue #1608

Open andrewculver opened 4 months ago

andrewculver commented 4 months ago
Checking NodeJS

Bullet Train requires Node.js 20.15.0 and `node -v` returns 16.17.0.
Try proceeding with Node 16.17.0 anyway? [Y/n]
n
You've chosen not to continue with Node 16.17.0. Goodbye.
Checking yarn

Bullet Train requires yarn 4.2.2 and `yarn -v` returns 1.22.19.
Try proceeding with yarn 1.22.19 anyway? [Y/n]
n
You've chosen not to continue with yarn 1.22.19. Goodbye.

And when I try to run yarn set version 4.2.2 I get the following:

error This project's package.json defines "packageManager": "yarn@4.2.2". However the current global version of Yarn is 1.22.22.

Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.

Except that running corepack enable doesn't fix anything!

jagthedrummer commented 4 months ago

@andrewculver like #1606 I think the question here is what method we'd use to try to handle installing node for people.

I'm surprised that corepack enable didn't do anything. When I've switched node versions locally it's worked just fine to do npm install -g yarn && corepack enable.

Trying this to test:

$ npm -g uninstall yarn

removed 1 package in 131ms
Reshimming asdf nodejs...
$ ./bin/setup-scripts/check_yarn.rb

--------------------------------------------------------------------------------
Checking yarn

No preset version installed for command yarn
Please install a version by running one of the following:

asdf install nodejs 20.15.0

or add one of the following versions in your config file at /Users/jgreen/.tool-versions
nodejs 20.5.1
nodejs 20.6.1
nodejs 20.7.0
nodejs 20.8.0
nodejs 20.8.1
You don't have yarn installed. We can't proceed without it. Try `npm install -g yarn && corepack enable`.
$ npm install -g yarn && corepack enable

added 1 package in 281ms
Reshimming asdf nodejs...
$ ./bin/setup-scripts/check_yarn.rb

--------------------------------------------------------------------------------
Checking yarn

Bullet Train requires yarn 4.2.2 and `yarn -v` returns 4.2.2.