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

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

Open
remluben opened this issue May 6, 2024 · 2 comments

Comments

@remluben
Copy link

remluben commented May 6, 2024

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 remluben changed the title next/content missing dependency when dependencies installed with --omit=dev Possible bug with missing dependency when dependencies installed with --omit=dev May 6, 2024
@farnabaz
Copy link
Member

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

@remluben
Copy link
Author

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

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

No branches or pull requests

2 participants