container-registry / backstage-plugin-harbor-backend

MIT License
6 stars 17 forks source link

Module Not Found in new Backend system #118

Open tam-pham-ts opened 2 months ago

tam-pham-ts commented 2 months ago

Hi team, I face an issue when installing backstage-plugin-harbor-backend package. I follow the installation guide:

yarn --cwd packages/backend add @bestsellerit/backstage-plugin-harbor-backend

Installation result:

success Saved lockfile.
warning Workspaces can only be enabled in private projects.
success Saved 3 new dependencies.
info Direct dependencies
info All dependencies
├─ @bestsellerit/backstage-plugin-harbor-backend@0.3.2
├─ @types/scheduler@0.16.8
└─ app@0.0.0
✨  Done in 22.88s.

But when running the backstage application

yarn dev

It throws an error

[1] Error: Cannot find module '@bestsellerit/backstage-plugin-harbor-backend'
[1] Require stack:
[1] - /Users/tam.pham/Desktop/TrustingSocial/XPLATFORM/backstage/packages/backend/src/index.ts
[1]     at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
[1]     at Module._load (node:internal/modules/cjs/loader:984:27)
[1]     at Module.require (node:internal/modules/cjs/loader:1231:19)
[1]     at require (node:internal/modules/helpers:179:18)
[1]     at <anonymous> (/Users/tam.pham/Desktop/TrustingSocial/XPLATFORM/backstage/packages/backend/src/index.ts:49:13)
[1]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[1]   code: 'MODULE_NOT_FOUND',
[1]   requireStack: [
[1]     '/Users/tam.pham/Desktop/TrustingSocial/XPLATFORM/backstage/packages/backend/src/index.ts'
[1]   ]
[1] }
[1] 
[1] Node.js v20.12.2
[1] 
[1] Change detected, restarting the development server...
[1] 
[1] (node:32187) Warning: Accessing non-existent property 'HostDiscovery' of module exports inside circular dependency
[1] (Use `node --trace-warnings ...` to show where the warning was created)
[1] (node:32187) Warning: Accessing non-existent property 'HostDiscovery' of module exports inside circular dependency
[1] node:internal/modules/cjs/loader:1143
[1]   const err = new Error(message);
[1]               ^
[1] 
[1] Error: Cannot find module '@bestsellerit/backstage-plugin-harbor-backend'
[1] Require stack:
[1] - /Users/tam.pham/Desktop/TrustingSocial/XPLATFORM/backstage/packages/backend/src/index.ts
[1]     at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
[1]     at Module._load (node:internal/modules/cjs/loader:984:27)
[1]     at Module.require (node:internal/modules/cjs/loader:1231:19)
[1]     at require (node:internal/modules/helpers:179:18)
[1]     at <anonymous> (/Users/tam.pham/Desktop/TrustingSocial/XPLATFORM/backstage/packages/backend/src/index.ts:49:13)
[1]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[1]   code: 'MODULE_NOT_FOUND',
[1]   requireStack: [
[1]     '/Users/tam.pham/Desktop/TrustingSocial/XPLATFORM/backstage/packages/backend/src/index.ts'
[1]   ]
[1] }

My Backstage version: 1.30.0-next.3

mikkeschiren commented 2 months ago

The npm package published doesn't support the new backend. You need a newer version, and you could use this package instead: https://www.npmjs.com/package/@digitalist-open-cloud/backstage-plugin-harbor-backend. Also follow how to add the backend to packages/backend/src/index.ts (see README in that package).