Skip to content

fatal error running bud install #699

@kellymears

Description

@kellymears

Description

yarn bud install exits with a fatal error. npx bud install exits successfully and displays a success message but doesn't actually update the project package.json.

Steps to reproduce

  1. fresh install
  2. yarn bud install
  3. ☠️

Expected behavior:
Packages are installed and process exits cleanly with a success message displayed.

Actual behavior:
Packages are maybe installed depending on how yarn resolves them. Process ultimately exits with an error.

Reproduces how often:

  • 100% of the time there will be an error message (with yarn)
  • Sometimes packages will not be installed. node_modules might be empty. it might have modules in it but not all of them.

Versions

latest

Additional information

❯ yarn bud install
yarn run v1.22.17
$ [sage_root]/node_modules/.bin/bud install
…  awaiting  installing dependencies @wordpress/browserslist-config,4.1.0,eslint,7.32.0,prettier,2.4.1,tailwindcss,2.2.19,react,17.0.2,react-dom,17.0.2,postcss,8.3.11,postcss-import,14.0.2,postcss-nested,5.0.6,postcss-preset-env,7.0.0
yarn [1/5] Validating package.json...

yarn [2/5] Resolving packages...

yarn [3/5] Fetching packages...

yarn [4/5] Linking dependencies...

yarn [5/5] Building fresh packages...

yarn success Saved lockfile.

yarn success Saved 0 new dependencies.

✔  success   installation complete
node:internal/modules/cjs/loader:941
  const err = new Error(message);
              ^

Error: Cannot find module './lib/handle'
Require stack:
- [sage_root]/node_modules/@oclif/errors/handle.js
- [sage_root]/node_modules/@roots/bud/bin/bud
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
    at Function.Module._load (node:internal/modules/cjs/loader:774:27)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at module.exports ([sage_root]/node_modules/@oclif/errors/handle.js:1:25) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '[sage_root]/node_modules/@oclif/errors/handle.js',
    '[sage_root]/node_modules/@roots/bud/bin/bud'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The bud install/bud init command runs yarn install and that overwrites @roots/bud (which is running the process). This doesn't effect the monorepo, only projects. I don't know if that's a yarn vs. yarn berry thing.

It doesn't cause this error with npx bud install but it also doesn't add the packages to the manifest.

bud install/bud init might be a fundamentally flawed idea. easiest path is to modify the project manifest and then tell the user to run the install themselves. This also means dropping the bud build command's --install flag. Ultimately, I really want to have it work the way it does in the monorepo.

For now I'll open a PR that changes bud install to:

  • modifies the package.json
  • informs the user that they need to run yarn or npm install

This will give us space to figure out how we might be able to include this feature as originally intended in a later release without the pressure of a busted command hanging over the project.

@QWp6t did you bump into this when you originally wrote the dependencies package for sage-cli?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingclirelated to bud clidependenciesPull requests that update a dependency file

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions