i thinks it happen when migrate to nuxt 2.x version from any version
not appearing โ Nuxt Warning
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ โ Nuxt Warning โ
โ โ
โ The command 'nuxt build' finished but did not exit after 5s โ
โ โ
โ This is most likely not caused by a bug in Nuxt.js โ
โ โ
โ Make sure to cleanup all timers and listeners you or your โ
โ plugins/modules start. โ
โ Nuxt.js will now force exit โ
โ โ
โ DeprecationWarning: Starting with Nuxt version 3 this will . โ
โ be a fatal error โ
โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
i have no idea from warning message Make sure to cleanup all timers and listeners you or your plugins/modules start
.
i already check out pluggins and module directory i wrote before,
but there's no timer/interval expressions.
how can i found cause of this things?
Hard to tell w/o the actual code :wink:
@manniL
repository in private, so can't give source code ๐ข
but i found nuxt warning occuured when mongose.connect
in serverMiddleware.
in nuxt.config.js
serverMiddleware: [
'~/serverMiddleware/index.js'
]
in ~/serverMiddleware/index.js
const app = express()
mongoose.connect('....') // it is problem
app.use('/api', require('.......')
how can i handle it?
it is the better case changing serverMiddleware to using Nuxt.js programmatically?
but i think it is more complex way to solve them..(because loosing serverMiddleware's pros)
The issues comes because we actually import the serverMiddleware
when running nuxt build
.
What you can do instead is to create a module for it @highalps
~/nuxt.config.js
:
export default {
modules: ['~/modules/api']
}
~/modules/api/index.js
:
module.exports = function (moduleOptions) {
// Add middleware only with `nuxt dev` or `nuxt start`
if (this.options.dev || this.options._start) {
this.addServerMiddleware('~/api/')
}
}
~/api/index.js
:
const express = require('express')
const app = express()
mongoose.connect('....') // it is problem
app.use('/', require('.......'))
module.exports = { path: '/api', handler: app }
You can learn more on https://nuxtjs.org/guide/modules
We are talking with the core team to work on a solution to avoid includes the serverMiddleware when running nuxt build
.
But mostly, we will soon have Nuxt services allowing to create your API in your Nuxt app without having to add serverMiddleware (better for perf & memory management + hot reloading).
@Atinux thanks a lot!!
I'am building a nuxt & electron & express application.
Eveverything is ok when i build & start an application on web.
But when i use electron-builder, it works on developer mode, but not on production.
I think, i need to add a new parameter, etc: || this.options.ELECTRON. But what is it ?
if (this.options.dev || this.options._start || etc. this.options.ELECTRON) {
this.addServerMiddleware('~/server/index.js')
}
I started getting this issue once I enabled HardSourceWebpackPlugin
in production build
I was able to reproduce an issue when running nuxt build
locally without HardSourceWebpackPlugin
enabled so I guess it's not related
same problem here. I also used recently HardSourceWebpackPlugin
when i use parallel in build ๏ผi get this issue
@fpl1104 Same here. According to nuxt doc, parallel is an โ ๏ธ Experimental feature i think.
Is there any way to fix it by not disabling parallel
option?
@arnabrahman Obviously yes, but how can I fix it?
@Atinux please, reopen this issue since it can be reproduced with parralel:true and it's still occurring in 2.13.1
Could your provide a reproduction and mention me please?
Most helpful comment
The issues comes because we actually import the
serverMiddleware
when runningnuxt build
.What you can do instead is to create a module for it @highalps
~/nuxt.config.js
:~/modules/api/index.js
:~/api/index.js
:You can learn more on https://nuxtjs.org/guide/modules
We are talking with the core team to work on a solution to avoid includes the serverMiddleware when running
nuxt build
.But mostly, we will soon have Nuxt services allowing to create your API in your Nuxt app without having to add serverMiddleware (better for perf & memory management + hot reloading).