redwoodjs / redwood

The App Framework for Startups
https://redwoodjs.com
MIT License
17.32k stars 993 forks source link

`yarn rw upgrade` fails without -t flag #1850

Closed tctrautman closed 3 years ago

tctrautman commented 3 years ago

This isn't a big deal for me since there is a work-around, but it might be an issue for others just getting started:

Upgrading with this command doesn't work:

$ yarn rw upgrade
yarn run v1.19.1
$ /.../node_modules/.bin/rw upgrade
  ✔ Checking installed packages
    ✔ Found @redwoodjs/auth
  ✔ Running upgrade command
    ✔ Running @redwoodjs package interactive upgrade CLI
error Couldn't find any versions for "tailwindcss" that matches "compat@^2.0.1"

But upgrading while specifying the version does:

$ yarn rw upgrade -t 0.25.1
yarn run v1.19.1
$ /.../node_modules/.bin/rw upgrade -t 0.25.1
  ✔ Checking installed packages
    ✔ Found @redwoodjs/auth
  ✔ Running upgrade command
    ✔ Force upgrading @redwoodjs packages to latest 0.25.1 release
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
...

I'm not sure what's causing this, and I wasn't able to find an existing issue so maybe it's just a "me" problem?

My best guess is that this has something to do with how I installed tailwind (iirc I installed before the CLI command existed,) but re-installing with the CLI command didn't seem to fix it 🤷

thedavidprice commented 3 years ago

Thanks @tctrautman I'll try to take a look at this. My guess is that anyone who installed Tailwind will run into it.

Under the hood, there are actually two different mechanics at work. rw upgrade using a Yarn interactive to upgrade only the @redwoodjs packages (why it's looking at the tailwind package is beyond me... I'm not particularly loving Yarn this week). For tags, we do some custom logic to target specific packages and then basically run the set through yarn upgrade [packages@tag]. fwiw...

tctrautman commented 3 years ago

Ah, that's interesting -- thanks for the detailed response @thedavidprice!

thedavidprice commented 3 years ago

@tctrautman I could not duplicate this locally. On a project running Redwood v0.24.0, I first ran yarn rw setup tailwind. Then I ran yarn rw upgrade, which worked successfully all the way through.

I'm on a Mac. You? Also, could you paste the contents of your web/package.json? Mine (after upgrade):

// web/package.json

{
  "name": "web",
  "version": "0.0.0",
  "private": true,
  "browserslist": {
    "development": [
      "last 1 version"
    ],
    "production": [
      "defaults",
      "not IE 11",
      "not IE_Mob 11"
    ]
  },
  "dependencies": {
    "@redwoodjs/auth": "^0.25.1",
    "@redwoodjs/forms": "^0.25.1",
    "@redwoodjs/router": "^0.25.1",
    "@redwoodjs/web": "^0.25.1",
    "netlify-identity-widget": "^1.9.1",
    "prop-types": "^15.7.2",
    "react": "^16.13.1",
    "react-dom": "^16.13.1"
  },
  "devDependencies": {
    "autoprefixer": "9.8.6",
    "postcss-loader": "4.0.2",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat"
  }
}
tctrautman commented 3 years ago

Huh... that's odd. Hopefully this means it's not a wide-spread problem.

I'm also on a Mac. I'm on yarn version 1.19.1 and node version v14.15.0

Below is my package.json -- the value for "tailwindcss" under devDependencies does seem unusual.

{
  "name": "web",
  "version": "0.0.0",
  "private": true,
  "browserslist": {
    "development": [
      "last 1 version"
    ],
    "production": [
      "defaults",
      "not IE 11",
      "not IE_Mob 11"
    ]
  },
  "dependencies": {
    "@redwoodjs/auth": "0.25.1",
    "@redwoodjs/forms": "0.25.1",
    "@redwoodjs/router": "0.25.1",
    "@redwoodjs/web": "0.25.1",
    "@stripe/stripe-js": "^1.11.0",
    "@tailwindcss/aspect-ratio": "^0.2.0",
    "@tailwindcss/forms": "^0.2.1",
    "@tailwindcss/typography": "^0.3.1",
    "@tailwindui/react": "^0.1.1",
    "aws-sdk": "^2.848.0",
    "axios": "^0.21.0",
    "gotrue-js": "^0.9.27",
    "lottie-react-web": "^2.2.2",
    "luxon": "^1.25.0",
    "prop-types": "^15.7.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-ga": "^3.3.0",
    "react-helmet": "^6.1.0",
    "react-loading-skeleton": "^2.1.1",
    "react-quill": "^1.3.5",
    "react-spinners": "^0.9.0",
    "react-trix-rte": "^1.0.7",
    "react-typist": "^2.0.5",
    "react-typist-loop": "^0.0.5"
  },
  "devDependencies": {
    "autoprefixer": "9.8.6",
    "postcss-loader": "4.0.2",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat",
    "tailwindcss@compat": "^2.0.1"
  }
}
thedavidprice commented 3 years ago

Looks like some duplication here:

  "devDependencies": {
...
    "tailwindcss": "npm:@tailwindcss/postcss7-compat",
    "tailwindcss@compat": "^2.0.1"
  }

There have been a few rounds of improvements to the setup tailwind command, including variations with handling the postcss7 compatibility. Looks like you got caught somewhere in between (maybe).

tctrautman commented 3 years ago

Ahh, that's probably it, thanks @thedavidprice 🙌 . I'll dedupe these before upgrading next time and see if that does the trick. Closing this ticket out for now -- I'll revive it if I can't fix on the next upgrade.

tctrautman commented 3 years ago

Worked like a charm -- thanks again @thedavidprice