New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\...\Desktop\...\server\node_modules\lodash-es\lodash.js require() of ES modules is not supported. #1405
Comments
Yes I started getting the same error from yesterday too. AdminJS version 6.8.3.
|
I get the same error. My setup is a clean NestJS app
|
Can you share your const AdminJS = require('adminjs');
const express = require('express');
const AdminJSExpress = require('@adminjs/express');
const start = () => {
const app = express();
const admin = new AdminJS({
rootPath: '/'
});
const adminRouter = AdminJSExpress.buildRouter(admin);
app.use(admin.options.rootPath, adminRouter);
app.listen(7070, () => {
console.log('app started');
});
}
start(); {
"name": "adminjs-lodash-test",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@adminjs/express": "^5.1.0",
"adminjs": "^6.8.3",
"express": "^4.18.2",
"express-formidable": "^1.2.0",
"express-session": "^1.17.3",
"tslib": "^2.5.0"
}
} |
Mine is:
It's a clean NestJS app with MikroORM. |
can you try updating |
@dziraf Here is my package.json:
|
I've already tried the latest version, and the problem is the same. |
When does the error appear? when you visit a specific page or right after you start the server? |
@dziraf the moment you start the server |
@eakenbor @konrad147 @FordeD can you try version 6.8.4? Also after updating make sure |
@dziraf the error has gone away now. Thanks. |
6.8.4 solves the issue for me. Thanks! |
I am facing this issue on the latest version: 7.0.9 Here's the error:
Here's my package.json: {
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "nodemon dist/index.js",
"watch": "tsc -w",
"typeorm:cli": "typeorm-ts-node-commonjs -d src/orm-config.ts"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/body-parser": "^1.19.2",
"@types/dotenv": "^8.2.0",
"@types/express": "^4.17.17",
"@types/node": "^20.4.0",
"nodemon": "^2.0.22",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
},
"dependencies": {
"@adminjs/express": "^6.0.0",
"@adminjs/typeorm": "^5.0.0",
"@types/bcrypt": "^5.0.0",
"@types/connect-pg-simple": "^7.0.0",
"@types/express-session": "^1.17.7",
"adminjs": "^7.0.9",
"bcrypt": "^5.1.0",
"body-parser": "^1.20.2",
"connect-pg-simple": "^9.0.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"express-formidable": "^1.2.0",
"express-session": "^1.17.3",
"pg": "^8.11.1",
"reflect-metadata": "^0.1.13",
"tslib": "^2.6.0",
"typeorm": "^0.3.17"
}
} I am using typescript and getting this error with the output code. |
Version 7+ and it's compatible packages only work with ESM projects. |
well that's a bummer |
This setup works for me |
Contact Details
No response
What happened?
I installed the adminjs and I tried to use it like this:
And I got the following message:
Please how can I solve this problem?
Bug prevalence
Every time
AdminJS dependencies version
6.8.3
What browsers do you see the problem on?
No response
Relevant log output
No response
Relevant code that's giving you issues
No response
The text was updated successfully, but these errors were encountered: