Dependencies broken : SyntaxError: The requested module '@nuxt/kit' does not provide an export named 'addDevServerHandler'
Version
@nuxtjs/tailwindcss: 5.0.4 nuxt: 2.15.8
Steps to reproduce
Moving from 5.0.3 to 5.0.4 give me the following error : SyntaxError: The requested module '@nuxt/kit' does not provide an export named 'addDevServerHandler'
It seems due to the @nuxt/kit dependencie update, in 5.04, from npm:@nuxt/kit-edge@latest to ^3.0.0-rc.2
The strangest thing is that error come from the node_modules/@nuxtjs/tailwindcss/dist/module.mjs file, which indeed import addDevServerHandler from @nuxt/kit and ... declare these consts on top of the file :
const name = "@nuxtjs/tailwindcss";
const version = "5.1.2";
It's like if the dist/module.mjs which was packaged was the wrong one ; maybe you should just re-package the 5.0.4 ?
The strangest thing is that error come from the
node_modules/@nuxtjs/tailwindcss/dist/module.mjsfile, which indeed importaddDevServerHandlerfrom@nuxt/kitand ... declare these consts on top of the file :const name = "@nuxtjs/tailwindcss"; const version = "5.1.2";
Look like @nuxtjs/tailwindcss is resolve to version 5.1.2 instead of 5.0.4, I've installed using @nuxtjs/[email protected] and it's work fine.
Version 5.1.2 will break when not using @nuxt/kit@^3.0.0-rc.3 because addDevServerHandler is added in this version.
Try running npm why @nuxt/kit (or yarn) to see if package is resolved to version 3.0.0-rc.3 or not.
adding an empty array named devServerHandlers to nuxt.config file will solve the issue.
devServerHandlers: [],
adding an empty array named devServerHandlers to nuxt.config file will solve the issue.
devServerHandlers: [],
This is not fixing it. By the way, it doesn't exist any mention to a devServerHandlers parameter in my whole node_modules directory ; so this is probably something implemented in another package.
The strangest thing is that error come from the
node_modules/@nuxtjs/tailwindcss/dist/module.mjsfile, which indeed importaddDevServerHandlerfrom@nuxt/kitand ... declare these consts on top of the file :const name = "@nuxtjs/tailwindcss"; const version = "5.1.2";Look like
@nuxtjs/tailwindcssis resolve to version 5.1.2 instead of 5.0.4, I've installed using@nuxtjs/[email protected]and it's work fine.Version 5.1.2 will break when not using
@nuxt/kit@^3.0.0-rc.3becauseaddDevServerHandleris added in this version.Try running
npm why @nuxt/kit(or yarn) to see if package is resolved to version3.0.0-rc.3or not.
The wrong exact version was due to an error from me : I have "@nuxtjs/tailwindcss": "^5.0.4" in my dependencies, so indeed, it's allowing the patch and minors updates, like 5.1.* versions.
Fixing the dependencie version to "@nuxtjs/tailwindcss": "~5.0.4" avoid that, and it's working well in 5.0.4
But ... in practice, as we can see : 5.0.* is compatible with nuxt2 and nuxt3 5.1.* is not anymore compatible with nuxt2 due to the bump to @nuxt/kit 3.0.0-rc.3
So, as a breaking change, should this be fixed in 5.1 and only released in 6.* ?
But ... in practice, as we can see : 5.0.* is compatible with nuxt2 and nuxt3 5.1.* is not anymore compatible with nuxt2 due to the bump to @nuxt/kit 3.0.0-rc.3
So, as a breaking change, should this be fixed in 5.1 and only released in 6.* ?
5.1.2 is compatible with Nuxt 2, but you have to add devServerHandlers: [] in nuxt.config file.
But ... in practice, as we can see : 5.0.* is compatible with nuxt2 and nuxt3 5.1.* is not anymore compatible with nuxt2 due to the bump to @nuxt/kit 3.0.0-rc.3 So, as a breaking change, should this be fixed in 5.1 and only released in 6.* ?
5.1.2 is compatible with Nuxt 2, but you have to add
devServerHandlers: []in nuxt.config file.
As mentioned earlier : it's not working ; add devServerHandlers does nothing, the app still crash ... and it seems normal, as there is no reference to devServerHandlers anywhere in my node_modules directory, so the parameter does probably nothing in my configuration
PS : anyway, it's not important, I'm staying in 5.0.4 for now :)
adding an empty array named devServerHandlers to nuxt.config file will solve the issue.
devServerHandlers: [],
That workaround is indeed working 👍
import tailwindTypography from '@tailwindcss/typography'
export default {
buildModules: [
'@nuxtjs/tailwindcss'
],
devServerHandlers: [], // Workaround for https://github.com/nuxt-community/tailwindcss-module/issues/487
tailwindcss: {
config: {
plugins: [tailwindTypography]
}
}
}
I tried again to update today, and ... I finally found :
Even with @nuxtjs/tailwindcss requesting a "@nuxt/kit": "^3.0.0-rc.5", the installed version was 3.0.0-rc.1.
As the addDevServerHandler export being added in rc3, it could not work ...
I absolutely don't understand why this version bug happened, but I've "fixed" it by adding "@nuxt/kit": "^3.0.0-rc.5" to my dependencies (it was not working when adding it to the devDependencies)
Hey team, still no solution to this error.
Hi @Foddie2, is it possible for you to share context/reproduction of your application please? If the issue persists, I'll be happy to reopen this.
Nuxt 3.5.3 with Nitro 2.4.1 15:01:15 [get-port] Unable to find an available port (tried 3000). Using alternative port: 3005 15:01:16
ERROR Cannot start nuxt: The requested module '@nuxt/kit' does not provide an export named 'normalizeModuleTranspilePath' 15:01:17
import { useNuxt, resolveFiles, defineNuxtModule, addTemplate, addPlugin, addComponent, updateTemplates, addVitePlugin, addWebpackPlugin, findPath, addImportsSources, tryResolveModule, isIgnored, resolveAlias, addPluginTemplate, logger, normalizeModuleTranspilePath, resolvePath, createResolver, nuxtCtx, installModule, loadNuxtConfig, normalizeTemplate, compileTemplate, normalizePlugin, templateUtils } from '@nuxt/kit'; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: The requested module '@nuxt/kit' does not provide an export named 'normalizeModuleTranspilePath' at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21) at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
Requires an export named 'normalizeModuleTranspilePath'
Thanks but it'll be better if you could provide a reproduction over Stackblitz so we can investigate - https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
Thanks. I am sharing.
@ineshbose FYI #778
Getting the below error after updating my package.json
ERROR The requested module '@nuxt/kit' does not provide an export named 'addBuildPlugin'
@ineshbose FYI #778
Getting the below error after updating my package.json
ERROR The requested module '@nuxt/kit' does not provide an export named 'addBuildPlugin'
I asked before - is there a reason you're on RC version?