tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

Dependencies broken : SyntaxError: The requested module '@nuxt/kit' does not provide an export named 'addDevServerHandler'

Open Nabellaleen opened this issue 3 years ago • 7 comments

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 ?

Nabellaleen avatar Jun 01 '22 21:06 Nabellaleen

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";

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.

natchasj avatar Jun 03 '22 18:06 natchasj

adding an empty array named devServerHandlers to nuxt.config file will solve the issue.

devServerHandlers: [],

kenanduman1988 avatar Jun 07 '22 12:06 kenanduman1988

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.

Nabellaleen avatar Jun 08 '22 14:06 Nabellaleen

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";

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.

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.* ?

Nabellaleen avatar Jun 08 '22 14:06 Nabellaleen

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.

natchasj avatar Jun 13 '22 06:06 natchasj

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 :)

Nabellaleen avatar Jun 13 '22 15:06 Nabellaleen

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]
    }
  }
}

TheAlexLichter avatar Jun 15 '22 08:06 TheAlexLichter

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)

Nabellaleen avatar Aug 26 '22 22:08 Nabellaleen

Hey team, still no solution to this error.

Foddie2 avatar Jun 21 '23 11:06 Foddie2

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.

ineshbose avatar Jun 21 '23 12:06 ineshbose

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)

Foddie2 avatar Jun 21 '23 12:06 Foddie2

Requires an export named 'normalizeModuleTranspilePath'

Foddie2 avatar Jun 21 '23 12:06 Foddie2

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

ineshbose avatar Jun 21 '23 12:06 ineshbose

Thanks. I am sharing.

Foddie2 avatar Jun 21 '23 12:06 Foddie2

@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'

Foddie2 avatar Dec 15 '23 13:12 Foddie2

@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?

ineshbose avatar Dec 15 '23 13:12 ineshbose