why are dev dependencies needed at runtime ?
Closed this issue ยท 6 comments
I've created a fresh new project today with npx create-nuxt-app xxx
It was impossible to deploy it to heroku.
(It builded correctly but crashed on server start)
Multiple errors were thrown one after the other
Error: Cannot find module 'vuetify/es5/util/colors'
=> solved by moving@nuxtjs/vuetify
to dependenciesError: Cannot find module '@nuxtjs/eslint-module'
=> solved by moving@nuxtjs/eslint-module
to dependenciesError: Cannot find module '@nuxtjs/stylelint-module'
=> solved by moving@nuxtjs/stylelint-module
to dependencies
But those are bad fixes, those should stay in dev dependencies.
You can reproduce the error with the following steps :
npm install
npm run build
npm prune --production
npm run start
the options used for create-nuxt-app :
- npm
- Vuetify.js
- Express
- with all nuxt modules (axios, PWA support, dotenv)
- with all linting tools (ESLint, Prettier, Lint staged files, StyleLint)
- Jest
- Universal
- with jsconfig.json
I've created a repo to show the issue and the "fixes"
https://github.com/MathieuDerelle/issue-example-for-create-nuxt-app-1/commits/master
I have also found that I cannot build the production server with yarn install --production
and I have to instead use yarn install
or else I get dependency issues about eslint.
I think this error only happens with Express server, and it's an issue upstream with Nuxt, on this line
The hack to get around the issue is to add:
nuxt.options._start = true
Right before await nuxt.ready()
in your server/index.js here
I'm reopenning this issue. With a fresh yarn create nuxt-app
and yarn install --production
I get this error:
ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'regenerator-runtime/runtime'
@ ./.nuxt/client.js 24:0-37
@ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/client.js
I should be able to install for production and start without problem. Please keep a clean package.json ๐
edit: it's vue-jest
package who needs to be installed in production mode.
Bumping this ^.
I had to move a few devDependencies to dependencies in order to get nuxt to build with typescript - so not sure if this is outside the remit of the nuxt project (and more to do with typescript), or even just an issue with Vue itself...
@chrismooreproductions You need at least nuxt-start
and typescript-runtime in dependencies
. This is current nuxt2 limitation (we are working on new server engine that allows zero dependency deployments)