content icon indicating copy to clipboard operation
content copied to clipboard

Possible bug with missing dependency when dependencies installed with `--omit=dev`

Open remluben opened this issue 1 year ago • 2 comments

Environment

- Operating System: Darwin
- Node Version:     v21.4.0
- Nuxt Version:     3.11.1
- CLI Version:      3.11.1
- Nitro Version:    2.9.5
- Package Manager:  [email protected]
- Builder:          -
- User Config:      app, components, content, css, experimental, modules, i18n, imports, runtimeConfig, ssr, vite, devtools
- Runtime Modules:  floating-vue/nuxt, @nuxt/[email protected], @nuxtjs/[email protected], @pinia/[email protected], @pinia-plugin-persistedstate/[email protected]
- Build Modules:    -

Reproduction

  1. Setup a nuxt project
  2. Make sure commands are correctly setup
"scripts": {
  "dev": "nuxt",
  "build": "nuxt build",
  "start": "nuxt start",
  "generate": "nuxt generate"
}
  1. Add @nuxt/content package in your nuxt project in dependencies (not dev) "@nuxt/content": "^2.12.1",
  2. Run npm i --omit=dev
  3. Run npm run dev or npm run build
  4. See an error similar to this: Cannot find package 'github-slugger' imported from /some/path/here/index.mjs

Describe the bug

When installinging dependencies without dev-dependencies using --omit=dev the @nuxt/content seems to miss dependencies to github-slugger.

Important note: If you install all dependencies (including dev) by using npm i everything works as expected.

Additional context

No response

Logs

ERROR  Cannot find package 'github-slugger' imported from /some/path/here/.nuxt/prerender/index.mjs                                         9:45:40 AM

  at packageResolve (node:internal/modules/esm/resolve:853:9)
  at moduleResolve (node:internal/modules/esm/resolve:910:20)
  at defaultResolve (node:internal/modules/esm/resolve:1130:11)
  at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
  at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
  at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
  at link (node:internal/modules/esm/module_job:84:36) 



 ERROR  Cannot find package 'github-slugger' imported from /some/path/here/.nuxt/prerender/index.mjs                                         9:45:40 AM

remluben avatar May 06 '24 07:05 remluben

Did you use shamefully-hoist=true in .npmrc ? If not, try to add shamefully-hoist=true to .npmrc

farnabaz avatar Jun 21 '24 09:06 farnabaz

Hi @farnabaz, many thanks for your feedback. ✌️

I will review our setup and give your suggestions a try asap.

I will let you know about my findings.

Kind regards, Benjamin

remluben avatar Jun 21 '24 09:06 remluben

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Dec 09 '24 02:12 github-actions[bot]

I could not reproduce this issues anymore with a current install. @farnabaz many thanks for your feedback though. 👍

remluben avatar Dec 09 '24 18:12 remluben