docus icon indicating copy to clipboard operation
docus copied to clipboard

Completely broken installation with pnpm

Open brawaru opened this issue 2 years ago • 3 comments

Describe the bug

When installing with pnpm, the installation is completely broken and refuses to launch.

Steps to reproduce

  1. Run pnpm dlx nuxi init docs -t themes/docus (npx produces the same result)
  2. Run cd docs; pnpm dev

Expected behaviour

Dev server starts up and you see Docus app in its default configuration.

Actual behaviour

Dev server starts up, but immediately throws a bunch of errors and crashes with error.

Accessing / returns:

{
  "statusCode": 404,
  "statusMessage": "Cannot find any path matching /.",
  "stack": []
}
Console output
➜  /workspace pnpm dev

> [email protected] dev /workspace
> nuxi dev

Nuxt 3.7.0 with Nitro 2.6.1                                                                       2:01:20 PM
                                                                                                  2:01:21 PM
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

✔ Nuxt Devtools is enabled v0.6.7 (experimental)                                                 2:01:23 PM

 WARN  [nuxt] Two component files resolving to the same name Ellipsis:                            2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/elements/components/globals/Ellipsis.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/docus/components/app/Ellipsis.vue


 WARN  [nuxt] Two component files resolving to the same name SourceLink:                          2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/elements/components/globals/SourceLink.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/docus/components/docs/SourceLink.vue


 WARN  [nuxt] Two component files resolving to the same name DocumentDrivenNotFound:              2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/DocumentDrivenNotFound.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/docus/components/app/DocumentDrivenNotFound.vue


 WARN  [nuxt] Two component files resolving to the same name ProseA:                              2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseA.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseA.vue


 WARN  [nuxt] Two component files resolving to the same name ProseBlockquote:                     2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseBlockquote.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseBlockquote.vue


 WARN  [nuxt] Two component files resolving to the same name ProseCode:                           2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseCode.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseCode.vue


 WARN  [nuxt] Two component files resolving to the same name ProseCodeInline:                     2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseCodeInline.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseCodeInline.vue


 WARN  [nuxt] Two component files resolving to the same name ProseEm:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseEm.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseEm.vue


 WARN  [nuxt] Two component files resolving to the same name ProseH1:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseH1.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseH1.vue


 WARN  [nuxt] Two component files resolving to the same name ProseH2:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseH2.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseH2.vue


 WARN  [nuxt] Two component files resolving to the same name ProseH3:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseH3.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseH3.vue


 WARN  [nuxt] Two component files resolving to the same name ProseH4:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseH4.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseH4.vue


 WARN  [nuxt] Two component files resolving to the same name ProseH5:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseH5.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseH5.vue


 WARN  [nuxt] Two component files resolving to the same name ProseH6:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseH6.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseH6.vue


 WARN  [nuxt] Two component files resolving to the same name ProseHr:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseHr.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseHr.vue


 WARN  [nuxt] Two component files resolving to the same name ProseImg:                            2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseImg.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseImg.vue


 WARN  [nuxt] Two component files resolving to the same name ProseLi:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseLi.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseLi.vue


 WARN  [nuxt] Two component files resolving to the same name ProseOl:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseOl.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseOl.vue


 WARN  [nuxt] Two component files resolving to the same name ProseP:                              2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseP.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseP.vue


 WARN  [nuxt] Two component files resolving to the same name ProseStrong:                         2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseStrong.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseStrong.vue


 WARN  [nuxt] Two component files resolving to the same name ProseTable:                          2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseTable.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseTable.vue


 WARN  [nuxt] Two component files resolving to the same name ProseTbody:                          2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseTbody.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseTbody.vue


 WARN  [nuxt] Two component files resolving to the same name ProseTd:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseTd.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseTd.vue


 WARN  [nuxt] Two component files resolving to the same name ProseTh:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseTh.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseTh.vue


 WARN  [nuxt] Two component files resolving to the same name ProseThead:                          2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseThead.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseThead.vue


 WARN  [nuxt] Two component files resolving to the same name ProseTr:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseTr.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseTr.vue


 WARN  [nuxt] Two component files resolving to the same name ProseUl:                             2:01:25 PM

 - /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/components/Prose/ProseUl.vue
 - /workspace/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@nuxt-themes/typography/components/global/ProseUl.vue

ℹ Vite client warmed up in 6836ms                                                                2:01:33 PM

[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/preprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/postprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/preprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/postprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/preprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/postprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/preprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/postprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/preprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  "micromark/lib/preprocess.js" is imported by "node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs", but could not be resolved – treating it as an external dependency.


[2:01:34 PM]  WARN  (node-resolve plugin) Could not resolve import "micromark/lib/postprocess.js" in /workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs using exports defined in /workspace/node_modules/.pnpm/[email protected]/node_modules/micromark/package.json.


[2:01:34 PM]  WARN  "micromark/lib/postprocess.js" is imported by "node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/runtime/transformers/csv/from-csv.mjs", but could not be resolved – treating it as an external dependency.

✔ Nitro built in 2870 ms                                                                   nitro 2:01:35 PM

[2:01:35 PM]  ERROR  [worker reload] [worker init] Package subpath './lib/preprocess.js' is not defined by "exports" in /workspace/node_modules/micromark/package.json imported from /workspace/.nuxt/dev/index.mjs

  at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
  at new NodeError (node:internal/errors:399:5)
  at exportsNotFound (node:internal/modules/esm/resolve:361:10)
  at packageExportsResolve (node:internal/modules/esm/resolve:697:9)
  at packageResolve (node:internal/modules/esm/resolve:872:14)
  at moduleResolve (node:internal/modules/esm/resolve:938:20)
  at defaultResolve (node:internal/modules/esm/resolve:1153:11)
  at nextResolve (node:internal/modules/esm/loader:163:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
  at link (node:internal/modules/esm/module_job:76:36)

^C ELIFECYCLE  Command failed.

Example code

https://codesandbox.io/p/sandbox/upbeat-chebyshev-639jvp

Environment

Codesandbox

------------------------------
- Operating System: Linux
- Node Version:     v16.17.0
- Nuxt Version:     3.7.0
- CLI Version:      3.7.0
- Nitro Version:    2.6.1
- Package Manager:  [email protected]
- Builder:          -
- User Config:      extends, modules
- Runtime Modules:  @nuxtjs/[email protected], @nuxt/[email protected]
- Build Modules:    -
------------------------------

Dev machine

------------------------------
- Operating System: Windows_NT
- Node Version:     v18.16.1
- Nuxt Version:     3.7.0
- CLI Version:      3.7.0
- Nitro Version:    2.6.1
- Package Manager:  [email protected]
- Builder:          -
- User Config:      extends, modules
- Runtime Modules:  @nuxtjs/[email protected], @nuxt/[email protected]
- Build Modules:    -
------------------------------

Additional context

When installing with npm, there also a lot of warnings, but no errors, and it runs.

Also, I think I managed to get it to work with the following steps:

  1. Add strict-peer-dependencies=false to .npmrc
  2. Delete pnpm-lock.yaml and node_modules (if exists)
  3. Install everything with npm
  4. Delete node_modules again
  5. Run pnpm import

brawaru avatar Aug 27 '23 14:08 brawaru

I think the cause is the use of micromark 4.0.0 via nuxt content as a workaround I managed to get it working by overriding the version to the one prior by adding the following to package.json

  "pnpm": {
    "overrides": {
      "micromark": "3.2.0"
    }
  }

I suspect this is also related to the below issue, as I was seeing the same errors as well at the same time as soon as I moved micromark from 4.0.0 to 3.2.0 it seemed to disapear.

  • https://github.com/nuxt-themes/docus/issues/971

Looks like its being pulled in via remark-mdc 1.2.0 which is in turn pulled in by nuxt content 2.7.2

It looks like the main branch of nuxt content also has it listed as a dependency although that hasn't made it's way through to a release yet, but it's still being pulled in via remark-mdc

  • https://github.com/nuxt/content/blob/main/package.json#L55

my guess is when remark-mdc was upped from 1.1.3 to 1.2.0 that's when it made it's way in as 1.1.3 was using micromark 3.1.0 but 1.2.0 moved to micromark 4.0.0

Hecatron avatar Aug 29 '23 00:08 Hecatron

@grbd https://github.com/nuxt/content/issues/2254#issuecomment-1694496697 seems to be alternative solution that doesn't involve overriding versions. ~~Haven't tried it yet though~~ Tried it, and it works! However there are some issues with this approach over just overriding the version.

brawaru avatar Aug 29 '23 09:08 brawaru

@grbd nuxt/content#2254 (comment) seems to be alternative solution that doesn't involve overriding versions. ~Haven't tried it yet though~ Tried it, and it works! However there are some issues with this approach over just overriding the version.

Yep confirmed the alias approach works for me too with pnpm

Hecatron avatar Aug 29 '23 13:08 Hecatron