adminjs
adminjs copied to clipboard
[Bug]: Can't import package
Contact Details
No response
What happened?
I have installed the following packages @adminjs/express: ^6.0.0, @adminjs/mongoose: 4.0.0, and adminjs: ^7.0.0. In my app.js file I am importing them as per the docs as follows:
import AdminJS from 'adminjs'
import * as AdminJSExpress from '@adminjs/express'
But when I run the app I get the following error:
file:///C:/Users/USER01/github/express-template/node_modules/adminjs/lib/locale/index.js:1
import deLocale from './de/translation.json' assert { type: 'json' };
^^^^^^
SyntaxError: Unexpected identifier
at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)
My node version is v14.17.3
Bug prevalence
Whenever I run the app
AdminJS dependencies version
"dependencies": {
"@adminjs/express": "^6.0.0",
"@adminjs/mongoose": "^4.0.0",
"adminjs": "^7.0.0",
"compression": "^1.7.4",
"express": "^4.18.2",
"express-formidable": "^1.2.0",
"express-session": "^1.17.3",
"helmet": "^6.1.5",
"pug": "^3.0.2",
"serve-favicon": "^2.5.0",
"tslib": "^2.5.0"
}
What browsers do you see the problem on?
Chrome
Relevant log output
file:///C:/Users/USER01/github/express-template/node_modules/adminjs/lib/locale/index.js:1
import deLocale from './de/translation.json' assert { type: 'json' };
^^^^^^
SyntaxError: Unexpected identifier
at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)
Relevant code that's giving you issues
import AdminJS from 'adminjs'
import * as AdminJSExpress from '@adminjs/express'
Please update NodeJS to LTS (v18)
the error continue, same installing the nodeJS v18
getting this error please help
I stopped getting this error using node v20