Possible bug with missing dependency when dependencies installed with `--omit=dev`
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
- Setup a nuxt project
- Make sure commands are correctly setup
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate"
}
- Add
@nuxt/contentpackage in your nuxt project in dependencies (not dev)"@nuxt/content": "^2.12.1", - Run
npm i --omit=dev - Run
npm run devornpm run build - 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
Did you use shamefully-hoist=true in .npmrc ? If not, try to add shamefully-hoist=true to .npmrc
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
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.
I could not reproduce this issues anymore with a current install. @farnabaz many thanks for your feedback though. 👍