Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency conflict (?) mdast-util-to-string and unist-util-stringify-position #2303

Closed
ijkml opened this issue Sep 12, 2023 · 4 comments · Fixed by #2313
Closed

dependency conflict (?) mdast-util-to-string and unist-util-stringify-position #2303

ijkml opened this issue Sep 12, 2023 · 4 comments · Fixed by #2313

Comments

@ijkml
Copy link

ijkml commented Sep 12, 2023

Environment

  • Operating System: Linux
  • Node Version: v20.5.0
  • Nuxt Version: 3.7.1
  • CLI Version: 3.8.3
  • Nitro Version: 2.6.3
  • Package Manager: pnpm@8.7.5
  • Builder: -
  • User Config: devServer, app, routeRules, alias, modules, extends, content, experimental, vite, css, typescript, devtools
  • Runtime Modules: @vueuse/nuxt@10.4.1, @unocss/nuxt@0.55.7, @nuxt/content@2.8.2
  • Build Modules: -

Reproduction

Clone, install, and run dev command
https://github.com/ijkml/nuxt-starter/tree/main

Describe the bug

There is a dependency conflict with @antfu/eslint-config-vue. When the eslint plugin is installed, Nuxt throws:

ERROR  [worker reload] [worker init] The requested module 'PROJECT-DIR/node_modules/.pnpm/unist-util-stringify-position@2.0.3/node_modules/unist-util-stringify-position/index.js' does not provide an export named 'stringifyPosition'

  import { stringifyPosition } from 'node_modules/.pnpm/unist-util-stringify-position@2.0.3/node_modules/unist-util-stringify-position/index.js';
         ^^^^^^^^^^^^^^^^^
  SyntaxError: The requested module 'node_modules/.pnpm/unist-util-stringify-position@2.0.3/node_modules/unist-util-stringify-position/index.js' does not provide an export named 'stringifyPosition'
  at ModuleJob._instantiate (node:internal/modules/esm/module_job:122:21)
  at async ModuleJob.run (node:internal/modules/esm/module_job:188:5)
  at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24)
  at async loadESM (node:internal/process/esm_loader:40:7)
  at async handleMainPromise (node:internal/modules/run_main:66:12)

I think that's because @antfu/eslint-config-vue depends on an older version of unist-util-stringify-position and it gets hoisted.

pnpm why unist-util-stringify-position gives (truncated):

@antfu/eslint-config-vue 0.41.2
├─┬ @antfu/eslint-config-basic 0.41.2
│ └─┬ eslint-plugin-markdown 3.0.1
│   └─┬ mdast-util-from-markdown 0.8.5
│     └── unist-util-stringify-position 2.0.3
└─┬ @antfu/eslint-config-ts 0.41.2
  └─┬ @antfu/eslint-config-basic 0.41.2
    └─┬ eslint-plugin-markdown 3.0.1
      └─┬ mdast-util-from-markdown 0.8.5
        └── unist-util-stringify-position 2.0.3

[...Nuxt Content, quite long, but 4.0.0 and 3.0.3]

I tried setting strict-peer-dependencies=true, but that didn't help. Installing these dependencies manually resolves the issue.

Could it be related to #2063? Not same, but similar issue. It was fixed by #2066 but later removed. Maybe adding them as dependencies could fix this?

Additional context

import { toString } from 'mdast-util-to-string'
import { preprocess, postprocess } from 'micromark'
import { stringifyPosition } from 'unist-util-stringify-position'

Logs

No response

@phojie
Copy link

phojie commented Sep 12, 2023

I have this one too, its almost a week, still cant figure it out. any help from @antfu please ?

@ijkml
Copy link
Author

ijkml commented Sep 12, 2023

@phojie, if it's a blocker you can just install both dependencies.

pnpm i -d mdast-util-to-string unist-util-stringify-position

@phojie
Copy link

phojie commented Sep 12, 2023

@phojie, if it's a blocker you can just install both dependencies.

pnpm i -d mdast-util-to-string unist-util-stringify-position

I had actually tried it in v3 before, and it wasn't working. However, I tried it again with the latest version, which is v4, and it's working. Thanks, man!

@productdevbook
Copy link
Sponsor Member

new install same problem

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants