3

I installed AdminJS and was trying to run my application but I am coming across this Error

It says: Error: Cannot find module '@adminjs/design-system'

Even though design-system exists and I even added it as a require statement

const AdminJSDesignSystem = require("./@adminjs/design-system");

I also tried installing it again but it gave a huge error Right here

Please help me fix this. I have got here after being through so many errors and fixing them and even now these errors won't stop popping up.

3 Answers3

0

looks like you are importing it using a relative path.

You should change that to just the package name

e.g. const AdminJSDesignSystem = require("@adminjs/design-system");

George
  • 1,706
  • 1
  • 11
  • 12
0

You need to do something like this:

const AdminJSDesignSystem = require("@adminjs/design-system");
Drashti Kheni
  • 1,065
  • 9
  • 23
0

Make sure you have followed the official guide of AdminJS and adminjs/design-system that:

  1. You have the admin user right to install things on your machine.

  2. You have installed one of Express, Hapi and Koajs. If not,

    npm install express express-formidable
    
  3. You have installed AdminJS. If not,

    npm install adminjs @adminjs/express
    
  4. Finally, install according to the official doc:

    npm install styled-components @adminjs/design-system
    
iyhc
  • 134
  • 3
  • Installed everything again. Getting a new error now. C:\Program Files\airline\adminjs\lib\backend\utils\resources-factory\resources-factory.js:95 const resourceObject = rawResource.resource || rawResource; ^ TypeError: Cannot read properties of undefined (reading 'resource') – Binaryellipse Aug 18 '22 at 06:00
  • This is because your rawResource object does not contain the property 'resource'. From now on this is not the problem on installation but how you input necessary data correctly. – iyhc Aug 19 '22 at 15:15