https://codesandbox.io/embed/qz9k4kj8m9
I ran( npm run dev) my application with following dependancies
"dependencies": {
"@fortawesome/free-solid-svg-icons": "5.5.0",
"@nuxtjs/axios": "5.3.6",
"bcrypt": "3.0.4",
"body-parser": "1.18.3",
"cookie-parser": "1.4.3",
"cross-env": "5.2.0",
"date-fns": "1.30.1",
"express": "4.16.4",
"express-session": "1.15.6",
"express-validator": "5.3.1",
"http-errors": "1.6.3",
"morgan": "1.9.1",
"multer": "1.4.1",
"mysql2": "1.6.4",
"nuxt": "2.3.4",
"nuxt-fontawesome": "0.3.0",
"pug": "2.0.0-beta11",
"uuid": "3.3.2",
"vee-validate": "2.1.5"
},
"devDependencies": {
"babel-eslint": "8.2.6",
"buefy": "0.7.3",
"eslint": "5.9.0",
"eslint-config-prettier": "3.3.0",
"eslint-loader": "2.1.1",
"eslint-plugin-prettier": "2.6.2",
"eslint-plugin-vue": "4.7.1",
"node-sass": "4.10.0",
"nodemon": "1.18.7",
"sass-loader": "7.1.0",
"webpack": "4.27.0"
}
Successfull build on npm run dev
(it working on old machine with same dependancies)
ERROR Cannot add module namespace property 'rootDir' to file:///D:/......../nuxt.config.js
TypeError: Cannot add module namespace property 'rootDir' to /D:/......./nuxt.config.js
at module.exports.R.inited.R.module.errorConstructError (node_modules\esm\esm.js:1:212779)
at new
at Object.Hp.e.set (node_modules\esm\esm.js:1:274998)
at loadNuxtConfig (node_modules\@nuxt\cli\dist\cli.js:2461:21)
at NuxtCommand.getNuxtConfig (node_modules\@nuxt\cli\dist\cli.js:2632:29)
at startDev (node_modules\@nuxt\cli\dist\cli.js:2963:21)
at NuxtCommand.run [as _run] (node_modules\@nuxt\cli\dist\cli.js:3011:11)
at NuxtCommand.run (node_modules\@nuxt\cli\dist\cli.js:2605:17)
at NuxtCommand.load.then.command (node_modules\@nuxt\cli\dist\cli.js:2817:30)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Same error:
Cannot add module namespace property '_nuxtConfigFile' to /nuxt.config.js
Cannot add module namespace property '_nuxtConfigFile' to /nuxt.config.js
occurs for nuxt 2.5.1 so we fallback to 2.3.4 but got above error
please provide a reproduction
@aldarund here is sample reproduction https://codesandbox.io/embed/qz9k4kj8m9
@rahulparanjapebics its caused by updated esm. Dont mix commonjs and es6 syntax. E.g. dont use require and import in same file ( and module.exports vs export default ). Use imports and export default
Temp workaround: In yarn.lock
esm@^3.2.20:
version "3.2.20"
Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:
Issues that are labeled as pending will not be automatically marked as stale.
Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:
Issues that are labeled as pending will not be automatically marked as stale.
Most helpful comment
@rahulparanjapebics its caused by updated esm. Dont mix commonjs and es6 syntax. E.g. dont use require and import in same file ( and module.exports vs export default ). Use imports and export default