Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Install hangs on postinstall @roots/browserslist-config (bud 6.14.*) #2370

Closed
3 tasks done
mensch opened this issue Jul 10, 2023 · 12 comments
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@mensch
Copy link

mensch commented Jul 10, 2023

Agreement

Describe the issue

This seems related to an earlier issue I reported, but this time the installation hangs on @roots/browserslist-config.

I don't use Tailwind and remove all packages and references before running yarn install. My yarn is set to berry (yarn set version berry) and uses node-modules as the nodeLinker value in .yarnrc.yml.

The resulting error is this (when I cancel the hanging operation):

^C➤ YN0009: │ @roots/browserslist-config@npm:6.12.3 couldn't be built successfully (exit code 129, logs can be found here: /private/var/folders/4f/h19r8j2j25xg29kdytj48_xh0000gn/T/xfs-47fc8e4c/build.log)

The log only displays this:

# This file contains the result of Yarn building a package (@roots/browserslist-config@npm:6.12.3)
# Script name: postinstall


These are my packages:

  "devDependencies": {
    "@roots/bud": "6.14.2",
    "@roots/bud-eslint": "6.14.2",
    "@roots/bud-prettier": "6.14.2",
    "@roots/bud-sass": "6.14.2",
    "@roots/bud-stylelint": "6.14.2",
    "@roots/eslint-config": "6.14.2",
    "@roots/sage": "6.14.2"
  },

The release notes of bud 6.12.* mention something about post install issues in relation to CI, but I don't think that's applicable in my case.

Expected Behavior

Full installation of 6.14.*

Actual Behavior

The installation hangs on installing @roots/browserslist-config.

Steps To Reproduce

  1. Add a new roots/sage theme
  2. Set version to berry (yarn set version berry)
  3. Remove all references of Tailwind
  4. Bump packages to 6.14.2 if necessary
  5. Run yarn install

version

6.14.2

Logs

No response

Configuration

No response

Relevant .budfiles

No response

@mensch mensch added the bug Something isn't working label Jul 10, 2023
@kellymears
Copy link
Member

kellymears commented Jul 11, 2023

I can't reproduce. Here's what I tried:

  1. Clone sage:
git clone git@github.com:roots/sage
  1. Add your dependency set to package.json:
  // ...
  "devDependencies": {
    "@roots/bud": "6.14.2",
    "@roots/bud-eslint": "6.14.2",
    "@roots/bud-prettier": "6.14.2",
    "@roots/bud-sass": "6.14.2",
    "@roots/bud-stylelint": "6.14.2",
    "@roots/eslint-config": "6.14.2",
    "@roots/sage": "6.14.2"
  },
  "packageManager": "yarn@3.6.1"
}
  1. Run yarn set version berry
➤ YN0000: Retrieving https://repo.yarnpkg.com/3.6.1/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-3.6.1.cjs
➤ YN0000: Done in 0s 351ms
  1. Edit generated yarnrc.yml:
yarnPath: .yarn/releases/yarn-3.6.1.cjs
nodeLinker: node-modules
  1. Run yarn:
➤ YN0000: ┌ Resolution step
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0002: │ @roots/bud-react@npm:6.14.2 doesn't provide @babel/core (p168e4), requested by @babel/preset-react
➤ YN0002: │ @roots/bud-sass@npm:6.14.2 doesn't provide postcss (p464d4), requested by postcss-scss
➤ YN0002: │ @roots/bud-sass@npm:6.14.2 doesn't provide stylelint (p32256), requested by stylelint-scss
➤ YN0002: │ @roots/bud-sass@npm:6.14.2 doesn't provide stylelint (pe7733), requested by stylelint-config-recommended-scss
➤ YN0002: │ @roots/bud-sass@npm:6.14.2 doesn't provide webpack (pb9519), requested by sass-loader
➤ YN0002: │ @roots/bud-stylelint@npm:6.14.2 doesn't provide webpack (pd6895), requested by stylelint-webpack-plugin
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide @babel/core (pda859), requested by @babel/eslint-parser
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pcabb3), requested by @babel/eslint-parser
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (p6ceb2), requested by @typescript-eslint/eslint-plugin
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pc39b8), requested by @typescript-eslint/parser
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pd1d83), requested by eslint-config-prettier
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (p9b323), requested by eslint-plugin-import
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (p79b89), requested by eslint-plugin-jsx-a11y
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (p37223), requested by eslint-plugin-prettier
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pcdf70), requested by eslint-plugin-react-hooks
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pc5423), requested by eslint-plugin-react
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide prettier (pbc406), requested by eslint-plugin-prettier
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 6s 679ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yargs-parser@npm:20.2.9 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yml-loader@npm:2.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yoga-wasm-web@npm:0.3.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ zwitch@npm:2.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 4s 607ms
➤ YN0000: ┌ Link step
➤ YN0007: │ @roots/bud-framework@npm:6.14.2 must be built because it never has been before or the last one failed
➤ YN0007: │ @roots/browserslist-config@npm:6.14.2 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js-pure@npm:3.26.1 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 17s 428ms
➤ YN0000: Done with warnings in 28s 841ms

If you check out the postinstall script that is hanging it doesn't do anything with tailwindcss or anything like that. Also, even if it fails it shouldn't cause problems.

All it is trying to do is make sure that browserslist is up-to-date. In a try/catch block, and using the execa parameter that allows for silent failures:

// @ts-check

/* eslint-disable n/no-process-env */
/* eslint-disable n/no-process-exit */

import {execaCommandSync} from 'execa'

if (!process.env.CI) {
  try {
    execaCommandSync(`npx browserslist --update-db`, {
      cwd: process.env.INIT_CWD ?? process.cwd(),
      reject: false,
      timeout: 10000,
    })
  } catch (e) {}
}

export {}

I think this may be a yarn issue.. Can you try wiping your cache?

yarn cache clean --all

# this might be overkill but forces yarn to re-evaluate the checksums of modules
yarn install --check-cache

Also interested in output from:

yarn node -v

And what happens if you run the script manually:

node node_modules/@roots/browserslist-config/scripts/postinstall.mjs

FWIW I use yarn berry personally and have had issues in the past with it:

  • Using an unexpected node version (my fault, admittedly)
  • Failing to build random dependencies (earlier this year it got hung up on building Chromium for Puppeteer and it was infuriating).

@kellymears
Copy link
Member

Not sure what you're upgrading from but it's worth noting that this postinstall script was last changed 4 months ago:

5c8b6a6

@mensch
Copy link
Author

mensch commented Jul 12, 2023

This was a new install, so no prior installation of this particular theme.

I've tried again today and this time the process hung on another package (core-js-pure). I've just let the process sit for a good while, instead of aborting it after a few minutes and now it's done. Resolution and fetch are quite fast, linking isn't (took 65 minutes in total). I guess there's something wrong on my end, so I'm closing this one.

Here's the output of yarn install --check-cache just for completeness:

➤ YN0000: ┌ Resolution step
➤ YN0002: │ @roots/bud-react@npm:6.14.2 doesn't provide @babel/core (p168e4), requested by @babel/preset-react
➤ YN0002: │ @roots/bud-sass@npm:6.14.2 doesn't provide postcss (p464d4), requested by postcss-scss
➤ YN0002: │ @roots/bud-sass@npm:6.14.2 doesn't provide stylelint (p32256), requested by stylelint-scss
➤ YN0002: │ @roots/bud-sass@npm:6.14.2 doesn't provide stylelint (pe7733), requested by stylelint-config-recommended-scss
➤ YN0002: │ @roots/bud-sass@npm:6.14.2 doesn't provide webpack (pb9519), requested by sass-loader
➤ YN0002: │ @roots/bud-stylelint@npm:6.14.2 doesn't provide webpack (pd6895), requested by stylelint-webpack-plugin
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide @babel/core (pda859), requested by @babel/eslint-parser
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pcabb3), requested by @babel/eslint-parser
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (p6ceb2), requested by @typescript-eslint/eslint-plugin
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pc39b8), requested by @typescript-eslint/parser
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pd1d83), requested by eslint-config-prettier
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (p9b323), requested by eslint-plugin-import
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (p79b89), requested by eslint-plugin-jsx-a11y
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (p37223), requested by eslint-plugin-prettier
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pcdf70), requested by eslint-plugin-react-hooks
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide eslint (pc5423), requested by eslint-plugin-react
➤ YN0002: │ @roots/eslint-config@npm:6.14.2 doesn't provide prettier (pbc406), requested by eslint-plugin-prettier
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 285ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 24s 844ms
➤ YN0000: ┌ Link step
➤ YN0007: │ @roots/bud-framework@npm:6.14.2 must be built because it never has been before or the last one failed
➤ YN0007: │ @roots/browserslist-config@npm:6.14.2 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js-pure@npm:3.26.1 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 64m 43s
➤ YN0000: Done with warnings in 65m 8s

@mensch mensch closed this as completed Jul 12, 2023
@mensch
Copy link
Author

mensch commented Sep 1, 2023

Just a follow-up, as I'm still having the problem and others have reported it too. The problem seems to be related to the post install script running yarn up -R caniuse-lite, which takes a very long time.

It's probably better to open a ticket over at browserslist/caniuse-lite right, as the issue doesn't really pertain to bud?

@mensch mensch reopened this Sep 18, 2023
@mensch
Copy link
Author

mensch commented Sep 18, 2023

I'm not sure if this is the proper thing to reopen this issue, but there are now a couple of users in the thread mentioned above that report the same issue. I'm unsure how to reproduce this outside bud's codebase, I've tried the following:

  • Created an empty directory
  • Ran yarn set version berry
  • Set the nodeLinker to node-modules
  • Ran yarn add caniuse-lite
  • Ran yarn up -R caniuse-lite

That seems to run without any delays whereas the same command in a Sage+Bud theme runs for almost half an hour. Do you perhaps know of another way of debugging this?

@kevinlisota
Copy link

I can confirm this exact same issue on a clean install of Sage 10. It took 8 minutes to run yarn on an extremely fast internet connection.

@montchr
Copy link

montchr commented Oct 5, 2023

I just updated my dependencies and am also blocked by this issue.

@retlehs
Copy link
Member

retlehs commented Oct 5, 2023

#2467 was recently merged and will be included in the next nightly release (in about 7 hours from now)

For folks that are running into this issue, we'd appreciate if you could let us know if the upcoming nightly works

We're still unable to reproduce this on our end, and the "+1" comments aren't particularly helpful if you're not willing to at least provide at a minimum some basic information about what versions of bud.js, node, and yarn that you're using. You can just throw a 👍 reaction at the top of this issue if you're also hitting this bug and unwilling to provide info about your setup.

@LucasDemea
Copy link

I had the same issue. The nightly build seems to solve it, thanks

@mensch
Copy link
Author

mensch commented Oct 26, 2023

I bought a new MacBook Pro recently (with an M2 chip) and thought the issue wouldn't occur on this new machine, but it did when I upgraded an existing project from 6.15.2 to 6.17.0.

I bumped all dependencies to the 2023.10.25-8 nightly and this seems to have resolved the issue. Linking now just took 2 seconds.

@elanclarkson
Copy link

I had the same problem with bud v6.17.0 and updating to the latest v6.18.0 seems to have fixed it, woohoo! Thank you bud devs!

@kellymears
Copy link
Member

kellymears commented Dec 7, 2023

I'm glad to read that this seems to be working better.

If anybody still has problems related to caniuse-lite in >=6.18.0 remember you can disable the behavior entirely by:

  • Run with --no-browserslist-update flag
  • Set BUD_BROWSERSLIST_UPDATE=false in .env
  • Set bud.browserslistUpdate to false in package.json (>=6.19.0):
{
  "bud": {
    "browserslistUpdate": false
  }
}

Just remember to run the caniuse-db upgrade yourself, from time-to-time.

That said, hopefully the new setup will simply work and reduce maintenance chores in your projects.

All's well that ends well, bet, but I still suspect this was a yarn thing because:

  1. It only ever happened to yarn users.
  2. As mentioned, I've experienced the same thing (just not related to this specific postinstall script).
  3. There are tons of issues related to postinstall hijinks open in the yarn repo.

But, pursuing it further seems foolish, given yarn's lead maintainer is adamantly opposed to postinstall scripts, conceptually:

If you're a package author, drop postinstall scripts now. We will make your life intentionally harder on the long term if you don't.

Fair enough, okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants