Adding bootstrap-icons to Sage project causes Bud to throw "Error: Cannot find package"

Summary:

Installing “bootstrap-icons” package using npm/yarn brakes Bud.

Details:

I am using Sage theme with the following dependencies:

    "@popperjs/core": "^2.11.6",
    "@roots/bud": "^6.6.1",
    "@roots/bud-eslint": "^6.6.1",
    "@roots/bud-prettier": "^6.6.1",
    "@roots/bud-sass": "^6.6.1",
    "@roots/bud-stylelint": "^6.6.1",
    "@roots/eslint-config": "^6.6.1",
    "@roots/sage": "^6.6.1",
    "bootstrap": "^5.2.2"

I have completly removed tailwind css and instead of it using bootstrap 5.

Now I want to add bootstrap icons but for some reason after installing package “bootstrap-icons” Bud starts complaining:

 bud clean

/home/xxx/themes/dev-alpha/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Cannot find package '/home/xxx/themes/dev-alpha/node_modules/bootstrap-icons/' imported from /home/xxx/themes/dev-alpha/node_
modules/@roots/bud/lib/cli/finder.js
    at new NodeError (file:///home/xxx/themes/dev-alpha/node_modules/import-meta-resolve/lib/errors.js:276:5)
    at legacyMainResolve (file:///home/xxx/themes/dev-alpha/node_modules/import-meta-resolve/lib/resolve.js:307:9)
    at packageResolve (file:///home/xxx/themes/dev-alpha/node_modules/import-meta-resolve/lib/resolve.js:1053:14)
    at moduleResolve (file:///home/xxx/themes/dev-alpha/node_modules/import-meta-resolve/lib/resolve.js:1117:20)
    at defaultResolve (file:///home/xxx/themes/dev-alpha/node_modules/import-meta-resolve/lib/resolve.js:1266:15)
    at resolve (file:///home/xxx/themes/dev-alpha/node_modules/import-meta-resolve/index.js:29:12)
    at file:///home/xxx/themes/dev-alpha/node_modules/@roots/bud/lib/cli/finder.js:47:24
    at Array.map (<anonymous>)
    at Commands.resolveExtensionCommandPaths (file:///home/xxx/themes/dev-alpha/node_modules/@roots/bud/lib/cli/finder.js:45:40)
    at Commands.getRegistrationModulePaths (file:///home/xxx/themes/dev-alpha/node_modules/@roots/bud/lib/cli/finder.js:25:27) {
  code: 'ERR_MODULE_NOT_FOUND'

Any idea what is going on?

It seems to me that Bud attempts to preload all the packages from node_modules directory during its run but for some reason fails with the ‘bootstrap-icons’.

For the time being I have replaced bootstrap-icons with feather-icons package. No issues so far.

I’m on the same boat but with “@heroicons/react”. Tried both ^1.0.6 and ^2.0.13
I’ll use feather-icons for the time being myself, thanks

Same issue here but with a different package. I tried aliasing the package as well but that doesn’t work either.

$ bud dev
/home/xxx/theme/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Cannot find package '/home/xxx/theme/node_modules/instantsearch.css/' imported from /home/xxx/theme/node_modules/@roots/bud/lib/cli/commands.js
    at new NodeError (file:///home/xxx/theme/node_modules/import-meta-resolve/lib/errors.js:276:5)
    at legacyMainResolve (file:///home/xxx/theme/node_modules/import-meta-resolve/lib/resolve.js:307:9)
    at packageResolve (file:///home/xxx/theme/node_modules/import-meta-resolve/lib/resolve.js:1053:14)
    at moduleResolve (file:///home/xx/theme/node_modules/import-meta-resolve/lib/resolve.js:1117:20)
    at defaultResolve (file:///home/xxx/theme/node_modules/import-meta-resolve/lib/resolve.js:1266:15)
    at resolve (file:///home/xxx/theme/node_modules/import-meta-resolve/index.js:29:12)
    at file:///home/xxx/theme/node_modules/@roots/bud/lib/cli/commands.js:46:24
    at Array.map (<anonymous>)
    at Commands.resolveExtensionCommandPaths (file:///home/xxx/theme/node_modules/@roots/bud/lib/cli/commands.js:44:40)
    at Commands.getRegistrationModulePaths (file:///home/xxx/theme/node_modules/@roots/bud/lib/cli/commands.js:24:27) {
  code: 'ERR_MODULE_NOT_FOUND'
}
error Command failed with exit code 7.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
1 Like

It looks like the package does not resolve properly because there is no entrypoint. There is no main entry in bootstrap-icon’s package.json, nor is there an index.js in the package root.

1 Like