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

why are dev dependencies needed at runtime ? #423

Closed
MathieuDerelle opened this issue Feb 4, 2020 · 6 comments · Fixed by nuxt/nuxt#7079
Closed

why are dev dependencies needed at runtime ? #423

MathieuDerelle opened this issue Feb 4, 2020 · 6 comments · Fixed by nuxt/nuxt#7079

Comments

@MathieuDerelle
Copy link

MathieuDerelle commented Feb 4, 2020

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

  1. Error: Cannot find module 'vuetify/es5/util/colors'
    => solved by moving @nuxtjs/vuetify to dependencies
  2. Error: Cannot find module '@nuxtjs/eslint-module'
    => solved by moving @nuxtjs/eslint-module to dependencies
  3. Error: 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
@MathieuDerelle
Copy link
Author

MathieuDerelle commented Feb 4, 2020

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

@colinmollenhour
Copy link

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.

@dholladay
Copy link

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

@existe-deja
Copy link

existe-deja commented Nov 23, 2020

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.

@chrismooreproductions
Copy link

chrismooreproductions commented Jan 2, 2021

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...

@pi0
Copy link
Member

pi0 commented Jan 4, 2021

@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)

jstrother added a commit to jstrother/cryptogram-game that referenced this issue Jan 20, 2021
moved @nuxtjs/eslint-module, @nuxtjs/stylelint-module, and @nuxtjs/vuetify from devDeps to dependencies
based upon this github issue- nuxt/create-nuxt-app#423
still trying to deploy to heroku
attempt #4
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

Successfully merging a pull request may close this issue.

6 participants