question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serving the application fails - Error: Cannot find module '@nuxtjs/eslint-module'

See original GitHub issue

Hi there,

trying to use this builder for my nuxt application but I’m getting an error when serving the app.

  • works fine with now/static-build
  • using nuxt 2.8.1
  • now.json below
  • nuxt.config below
  • output logs from ZEIT now below
  • package.json below
  • Deployment URL: https://www-efu6bvof8.now.sh/

now.json

{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/now-builder",
      "config": {}
    }
  ],
  "routes": [
    { "src": "/_nuxt/.+", "headers": { "Cache-Control": "max-age=31557600" } },
    { "src": "/(.*)", "dest": "/" }
  ]
}

Package.json

{
  "name": "tresor",
  "version": "1.0.0",
  "description": "Komm klar mit deinen Finanzen",
  "author": "Sumit Kumar",
  "private": true,
  "scripts": {
    "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
    "precommit": "yarn run lint",
    "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
    "build": "nuxt build",
    "now-build": "nuxt build",
    "start": "cross-env NODE_ENV=production node server/index.js",
    "generate": "nuxt generate"
  },
  "dependencies": {
    "@nuxtjs/axios": "^5.3.6",
    "@nuxtjs/bulma": "^1.2.1",
    "cross-env": "^5.2.0",
    "express": "^4.16.4",
    "node-sass": "^4.12.0",
    "nuxt": "^2.8.1",
    "sass-loader": "^7.1.0",
    "vue-focus": "^2.1.0"
  },
  "devDependencies": {
    "@nuxtjs/eslint-config": "^0.0.1",
    "@nuxtjs/eslint-module": "^0.0.1",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.15.1",
    "eslint-config-prettier": "^4.1.0",
    "eslint-config-standard": ">=12.0.0",
    "eslint-plugin-import": ">=2.16.0",
    "eslint-plugin-jest": ">=22.3.0",
    "eslint-plugin-node": ">=8.0.1",
    "eslint-plugin-nuxt": ">=0.4.2",
    "eslint-plugin-prettier": "^3.0.1",
    "eslint-plugin-promise": ">=4.0.1",
    "eslint-plugin-standard": ">=4.0.0",
    "eslint-plugin-vue": "^5.2.2",
    "nodemon": "^1.18.9",
    "prettier": "^1.16.4"
  }
}

nuxt.config

module.exports = {
  mode: 'universal',
  /*
   ** Headers of the page
   */
  head: {
    title: 'Tresor - Komm klar mit deinen Finanzen',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      {
        hid: 'description',
        name: 'description',
        content: process.env.npm_package_description || ''
      }
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: { color: '#fff' },
  /*
   ** Global CSS
   */
  css: [],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: [],
  /*
   ** Nuxt.js modules
   */
  modules: [
    // Doc:https://github.com/nuxt-community/modules/tree/master/packages/bulma
    '@nuxtjs/bulma',
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
    '@nuxtjs/eslint-module'
  ],
  /*
   ** Axios module configuration
   ** See https://axios.nuxtjs.org/options
   */
  axios: {},
  /*
   ** Build configuration
   */
  build: {
    postcss: {
      preset: {
        features: {
          customProperties: false
        }
      }
    },
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {}
  }
}

Output:

TART RequestId: 7be2acd5-5cf6-44c9-bc89-df5887d1fc3b Version: $LATEST
2019-06-22T11:29:13.419Z	20411dd3-9f6c-48a9-b4c2-b86874142c7a	λ Error while initializing nuxt: { /var/task/node_modules/@nuxt/core/dist/core.js:1
Error: Cannot find module '@nuxtjs/eslint-module'
Require stack:
- /var/task/node_modules/@nuxt/core/dist/core.js
- /var/task/now__launcher.js
- /var/runtime/node_modules/awslambda/index.js
    at Resolver.requireModule (/var/task/node_modules/@nuxt/core/dist/core.js:627:31)
    at ModuleContainer.addModule (/var/task/node_modules/@nuxt/core/dist/core.js:163:36)
    at promise.then (/var/task/node_modules/@nuxt/utils/dist/utils.js:1796:43)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
  code: 'MODULE_NOT_FOUND',
  requireStack: 
   [ '/var/task/node_modules/@nuxt/core/dist/core.js',
     '/var/task/now__launcher.js',
     '/var/runtime/node_modules/awslambda/index.js' ] }
END RequestId: 7be2acd5-5cf6-44c9-bc89-df5887d1fc3b
REPORT RequestId: 7be2acd5-5cf6-44c9-bc89-df5887d1fc3b	
Duration: 62.48 ms  Billed Duration: 100 ms   Memory Size: 3008 MB  Max Memory Used: 47 MB	
RequestId: 7be2acd5-5cf6-44c9-bc89-df5887d1fc3b Process exited before completing request


Spotted error in output logs:

Error: Cannot find module '@nuxtjs/eslint-module'

Any idea what I might be doing wrong here?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
pi0commented, Jun 23, 2019

Hi @codeofsumit. Please put @nuxtjs/eslint-module in devModules

5reactions
camcnzcommented, Jun 25, 2019

This doesn’t seem to work for google app engine? The only way I can get it work is to move “@nuxtjs/eslint-config”: “^0.0.1”, “@nuxtjs/eslint-module”: “^0.0.1”, into the package.json dependencies.

This is my server file.

const express = require('express')
const consola = require('consola')
const { Nuxt, Builder } = require('nuxt')
const app = express()

// Import and Set Nuxt.js options
const config = require('../nuxt.config.js')
config.dev = !(process.env.NODE_ENV === 'production')

async function start() {
  // Init Nuxt.js
  const nuxt = new Nuxt(config)

  const { host, port } = nuxt.options.server

  // Build only in dev mode
  if (config.dev) {
    const builder = new Builder(nuxt)
    await builder.build()
  } else {
    await nuxt.ready()
  }

  // Give nuxt middleware to express
  app.use(nuxt.render)

  // Listen the server
  app.listen(port, host)
  consola.ready({
    message: `Server listening on http://${host}:${port}`,
    badge: true
  })
}
start()
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
When you get the “cannot find module” error, or “module not found”, it means you've not installed the package you're trying to use....
Read more >
关于Error: Cannot find module '@nuxtjs/eslint ... - CSDN博客
1. 删除你的node_moudles目录,然后照着如下的我配置好的package.json(依赖部分)进行重新安装。(PS:NUXT.js(虽然好用)但自带的CLI真滴坑,各种不兼容).
Read more >
How to resolve "Cannot find module" error in Node - Sabe.io
The issue is that Node is unable to find the module that you are trying to import into your Node application. The most...
Read more >
[Solution] Error: Cannot Find Module "nodemailer" - Courier
What's Causing This Error? This error occurs when you have not installed the nodemailer library in your Node.js application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found