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

Build for production fails when dev dependency #934

Open
AntonLindell opened this issue Jan 2, 2025 · 5 comments
Open

Build for production fails when dev dependency #934

AntonLindell opened this issue Jan 2, 2025 · 5 comments
Labels
question Further information is requested

Comments

@AntonLindell
Copy link

Hi,

I am about to deploy my app and building with production flags (either NODE_ENV=production or --only=production), but the build crashes since my dependency is, as per the installation instructions, only for dev. But the @nuxtjs/tailwindcss is declared as any other module in the nuxt config, so the build fails with this message:

.449 > postinstall 9.449 > nuxt prepare 9.449 10.21 10.21 ERROR Could not load @nuxtjs/tailwindcss. Is it installed? 10.21 10.21 at loadNuxtModuleInstance (node_modules/@nuxt/kit/dist/index.mjs:2470:11) 10.21 at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2388:67) 10.21 at async initNuxt (node_modules/nuxt/dist/index.mjs:5275:5) 10.21 at async loadNuxt (node_modules/nuxt/dist/index.mjs:5459:5) 10.21 at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2640:19) 10.21 at async Object.run (node_modules/nuxi/dist/chunks/prepare.mjs:60:18) 10.21 at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.DSPrE7vg.mjs:1767:16) 10.21 at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.DSPrE7vg.mjs:1758:11) 10.21 at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.DSPrE7vg.mjs:1896:7) 10.21 10.21 10.21 10.21 ERROR Could not load @nuxtjs/tailwindcss. Is it installed?

Does anyone have a solution for this? It feels like I am missing something, this should be a no-brainer IMO.

Thanks!

@AntonLindell AntonLindell added the question Further information is requested label Jan 2, 2025
@hacknug
Copy link

hacknug commented Jan 5, 2025

Both nuxt and @nuxtjs/tailwindcss should be installed as the same type of dependency (doesn't matter if dependencies or devDependencies). Can you check if that's the case? This applies to any other modules you might be using too.

@AntonLindell
Copy link
Author

I see, nuxt is installed as a normal dependency. Can I have it as a devDependency and still make the build work when using --only=production flag?

@hacknug
Copy link

hacknug commented Jan 7, 2025

I see, nuxt is installed as a normal dependency. Can I have it as a devDependency and still make the build work when using --only=production flag?

Not sure. You can probably try it yourself and report back in case someone else experiences this issue.

Did installing nuxt and all modules as the same type of dependency solve your initial issue?

@AntonLindell
Copy link
Author

No unfortunately. But it works when the tailwind plugin is not a dev dependency!

@ineshbose
Copy link
Collaborator

Could you share your package.json and nuxt.config please?

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

No branches or pull requests

3 participants