torrust / torrust-index-gui

This repository serves as the frontend for the Torrust Index project.
https://torrust.com
Other
32 stars 16 forks source link

Build error in runner: `Rollup failed to resolve import ...` #621

Closed josecelano closed 2 months ago

josecelano commented 2 months ago
Run npm run build

> torrust-index-gui@3.0.0-beta build
> nuxt build

[log] Nuxt 3.11.2 with Nitro 2.9.6
[info] [nuxt:tailwindcss] Using Tailwind CSS from ~/assets/css/tailwind.css
[info] Building client...
[info] vite v5.2.13 building for production...
[info] transforming...

🌼   daisyUI [4](https://github.com/torrust/torrust-index-gui/actions/runs/10869961534/job/30161927416?pr=620#step:5:5).12.2
├─ ✔︎ 4 themes added        https://daisyui.com/docs/themes
╰─ ❤︎ Support daisyUI project:  https://opencollective.com/daisyui

[info] ✓ 172 modules transformed.
Error:  x Build failed in 6.21s
Error:  Nuxt Build Error: [vite]: Rollup failed to resolve import "torrust-index-types-lib" from "/home/runner/work/torrust-index-gui/torrust-index-gui/components/registration/RegistrationForm.vue?vue&type=script&setup=true&lang.ts".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
  This is most likely unintended because it can break your application at runtime.
  If you do want to externalize this module explicitly add it to
  `build.rollupOptions.external`
  at viteWarn (node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:68871:27)
  at onRollupWarning (node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:68899:9)
  at onwarn (node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:68[5](https://github.com/torrust/torrust-index-gui/actions/runs/10869961534/job/30161927416?pr=620#step:5:6)82:13)
  at node_modules/rollup/dist/es/shared/node-entry.js:18514:13
  at Object.logger [as onLog] (node_modules/rollup/dist/es/shared/node-entry.js:201[6](https://github.com/torrust/torrust-index-gui/actions/runs/10869961534/job/30161927416?pr=620#step:5:7)2:9)
  at ModuleLoader.handleInvalidResolvedId (node_modules/rollup/dist/es/shared/node-entry.js:1[9](https://github.com/torrust/torrust-index-gui/actions/runs/10869961534/job/30161927416?pr=620#step:5:10)104:26)
  at node_modules/rollup/dist/es/shared/node-entry.js:19062:26
Error: Process completed with exit code 1.
josecelano commented 2 months ago

https://github.com/torrust/torrust-index-gui/actions/runs/10869961534/job/30161927416?pr=620#step:5:21

josecelano commented 2 months ago

I usually work with a local version of the torrust-index-types-lib when I have to change both the app and the package. Althougth I changed back the package.json to sue the real package:

  "dependencies": {
    "torrust-index-api-lib": "^3.0.0-beta.2",
    "torrust-index-types-lib": "^3.0.0-beta.2",
  }

Instead of:

  "dependencies": {
    "torrust-index-api-lib": "^3.0.0-beta.2",
    "torrust-index-types-lib": "file:://../torrust-index-types-lib",
  }

In the package-lock.json I still had this:

    "../torrust-index-types-lib": {
      "version": "3.0.0-beta.2",
      "license": "SEE LICENSE IN COPYRIGHT",
      "devDependencies": {
        "typescript": "^5.2.2"
      }
    },

I tried a npm install and also removing node_modules but I didn't work. I fixed it with:

npm install torrust-index-types-lib@v3.0.0-beta.2