Deploy failure "Cannot find module"

Hello,
I’m having hard time deploying one of my websites…

The deployment fails with this error:
[fatal] Cannot find module '@nuxtjs/style-resources'

This error makes no sense, I am well aware that this module is installed.

What I using (@ last version):

  • nuxt
  • node-sass
  • sass-loader
  • @ nuxtjs/style-resources (i added a whitspace after @ because it’s considered as a mention by the forum apprently)

Please note that everything is specified in the package.json, no dependencies missing here. I would not post without making sure of that.

More information:

  • The build command is npm run generate, that command works perfectly on my local machine and the website is correctly build.
  • The node version (v14.15.5) is specified in the file .nvmrc
  • I use Windows 10 20H2 and build/commit from WSL1 Ubuntu 20.04.2 LTS
  • I also tested to build the app on a VM Ubuntu, works well.

What I tried so far:

Here are the current logs

3:08:16 PM: Build ready to start
3:08:18 PM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
3:08:18 PM: build-image tag: v3.6.1
3:08:18 PM: buildbot version: 3f7ff7bbf92b8c2ecf180659ea5b1472b472d308
3:08:18 PM: Fetching cached dependencies
3:08:18 PM: Starting to download cache of 131.9MB
3:08:20 PM: Finished downloading cache in 1.268860982s
3:08:20 PM: Starting to extract cache
3:08:25 PM: Finished extracting cache in 5.137332618s
3:08:25 PM: Finished fetching cache in 6.44661266s
3:08:25 PM: Starting to prepare the repo for build
3:08:28 PM: Preparing Git Reference refs/heads/debug
3:08:33 PM: Starting build script
3:08:33 PM: Installing dependencies
3:08:33 PM: Python version set to 2.7
3:08:33 PM: Started restoring cached node version
3:08:37 PM: Finished restoring cached node version
3:08:37 PM: Attempting node version ‘v14.15.5’ from .nvmrc
3:08:37 PM: v14.15.5 is already installed.
3:08:38 PM: Now using node v14.15.5 (npm v6.14.11)
3:08:38 PM: Started restoring cached build plugins
3:08:38 PM: Finished restoring cached build plugins
3:08:38 PM: Attempting ruby version 2.7.1, read from environment
3:08:40 PM: Using ruby version 2.7.1
3:08:40 PM: Using PHP version 5.6
3:08:40 PM: Started restoring cached node modules
3:08:40 PM: Finished restoring cached node modules
3:08:40 PM: Installing NPM modules using NPM version 6.14.11
3:08:53 PM: > ejs@ 2.7.4 postinstall /opt/build/repo/node_modules/ejs
3:08:53 PM: > node ./postinstall.js
3:08:53 PM: > nuxt@ 2.14.12 postinstall /opt/build/repo/node_modules/nuxt
3:08:53 PM: > opencollective || exit 0
3:08:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@ 1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
3:08:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@ 1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
3:08:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@ 2.3.2 (node_modules/fsevents):
3:08:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@ 2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
3:08:54 PM: added 63 packages from 56 contributors, removed 52 packages, updated 51 packages and audited 1603 packages in 13.051s
3:08:55 PM: 64 packages are looking for funding
3:08:55 PM: run npm fund for details
3:08:55 PM: found 0 vulnerabilities
3:08:55 PM: NPM modules installed
3:08:56 PM: Started restoring cached go cache
3:08:56 PM: Finished restoring cached go cache
3:08:56 PM: go version go1.14.4 linux/amd64
3:08:56 PM: go version go1.14.4 linux/amd64
3:08:56 PM: Installing missing commands
3:08:56 PM: Verify run directory
3:08:58 PM: ​
3:08:58 PM: ────────────────────────────────────────────────────────────────
3:08:58 PM: Netlify Build
3:08:58 PM: ────────────────────────────────────────────────────────────────
3:08:58 PM: ​
3:08:58 PM: ❯ Version
3:08:58 PM: @ netlify/build 9.1.2
3:08:58 PM: ​
3:08:58 PM: ❯ Flags
3:08:58 PM: deployId: 602e82e0fbacd500076d9dc4
3:08:58 PM: mode: buildbot
3:08:58 PM: ​
3:08:58 PM: ❯ Current directory
3:08:58 PM: /opt/build/repo
3:08:58 PM: ​
3:08:58 PM: ❯ Config file
3:08:58 PM: /opt/build/repo/netlify.toml
3:08:58 PM: ​
3:08:58 PM: ❯ Context
3:08:58 PM: production
3:08:58 PM: ​
3:08:58 PM: ────────────────────────────────────────────────────────────────
3:08:58 PM: 1. Build command from Netlify app
3:08:58 PM: ────────────────────────────────────────────────────────────────
3:08:58 PM: ​
3:08:58 PM: $ npm run generate
3:08:58 PM: > elua-frontend@ 1.0.0 generate /opt/build/repo
3:08:58 PM: > nuxt generate
3:08:58 PM: [fatal] Cannot find module ‘@ nuxtjs/style-resources’
3:08:58 PM: Require stack:
3:08:58 PM: - /opt/build/repo/node_modules/@ nuxt/core/dist/core.js
3:08:58 PM: - /opt/build/repo/node_modules/@ nuxt/cli/dist/cli-index.js
3:08:58 PM: - /opt/build/repo/node_modules/@ nuxt/cli/dist/cli.js
3:08:58 PM: - /opt/build/repo/node_modules/nuxt/bin/nuxt.js
3:08:58 PM: Error: Cannot find module ‘@ nuxtjs/style-resources’
3:08:58 PM: Require stack:
3:08:58 PM: - node_modules/@ nuxt/core/dist/core.js
3:08:58 PM: - node_modules/@ nuxt/cli/dist/cli-index.js
3:08:58 PM: - node_modules/@ nuxt/cli/dist/cli.js
3:08:58 PM: - node_modules/nuxt/bin/nuxt.js
3:08:58 PM: at Resolver.requireModule (node_modules/@ nuxt/core/dist/core.js:616:31)
3:08:58 PM: at ModuleContainer.addModule (node_modules/@ nuxt/core/dist/core.js:180:38)
3:08:58 PM: at node_modules/@ nuxt/utils/dist/utils.js:1859:43
3:08:58 PM: at async ModuleContainer.ready (node_modules/@ nuxt/core/dist/core.js:51:7)
3:08:58 PM: at async Nuxt._init (node_modules/@ nuxt/core/dist/core.js:716:5)
3:08:58 PM:
3:08:58 PM: ╭────────────────────────────────────────────────────────────────╮
3:08:58 PM: │ │
3:08:58 PM: │ :heavy_multiplication_x: Nuxt Fatal Error │
3:08:58 PM: │ │
3:08:58 PM: │ Error: Cannot find module ‘@ nuxtjs/style-resources’ │
3:08:58 PM: │ Require stack: │
3:08:58 PM: │ - /opt/build/repo/node_modules/@ nuxt/core/dist/core.js │
3:08:58 PM: │ - /opt/build/repo/node_modules/@ nuxt/cli/dist/cli-index.js │
3:08:58 PM: │ - /opt/build/repo/node_modules/@ nuxt/cli/dist/cli.js │
3:08:58 PM: │ - /opt/build/repo/node_modules/nuxt/bin/nuxt.js │
3:08:58 PM: │ │
3:08:58 PM: ╰────────────────────────────────────────────────────────────────╯
3:08:58 PM:
3:08:58 PM: npm ERR! code ELIFECYCLE
3:08:58 PM: npm ERR! errno 1
3:08:58 PM: npm ERR! elua-frontend@ 1.0.0 generate: nuxt generate
3:08:58 PM: npm ERR! Exit status 1
3:08:58 PM: npm ERR!
3:08:58 PM: npm ERR! Failed at the elua-frontend@ 1.0.0 generate script.
3:08:58 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
3:08:58 PM: npm ERR! A complete log of this run can be found in:
3:08:58 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-02-18T15_08_58_859Z-debug.log
3:08:58 PM: ​
3:08:58 PM: ────────────────────────────────────────────────────────────────
3:08:58 PM: “build.command” failed
3:08:58 PM: ────────────────────────────────────────────────────────────────
3:08:58 PM: ​
3:08:58 PM: Error message
3:08:58 PM: Command failed with exit code 1: npm run generate
3:08:58 PM: ​
3:08:58 PM: Error location
3:08:58 PM: In Build command from Netlify app:
3:08:58 PM: npm run generate
3:08:58 PM: ​
3:08:58 PM: Resolved config
3:08:58 PM: build:
3:08:58 PM: command: npm run generate
3:08:58 PM: commandOrigin: ui
3:08:58 PM: environment:
3:08:58 PM: - NODE_ENV
3:08:58 PM: - API_URL
3:08:58 PM: publish: /opt/build/repo/dist
3:08:59 PM: Caching artifacts
3:08:59 PM: Started saving node modules
3:08:59 PM: Finished saving node modules
3:08:59 PM: Started saving build plugins
3:08:59 PM: Finished saving build plugins
3:08:59 PM: Started saving pip cache
3:08:59 PM: Finished saving pip cache
3:08:59 PM: Started saving emacs cask dependencies
3:08:59 PM: Finished saving emacs cask dependencies
3:08:59 PM: Started saving maven dependencies
3:08:59 PM: Finished saving maven dependencies
3:08:59 PM: Started saving boot dependencies
3:08:59 PM: Finished saving boot dependencies
3:08:59 PM: Started saving rust rustup cache
3:08:59 PM: Finished saving rust rustup cache
3:08:59 PM: Started saving go dependencies
3:08:59 PM: Finished saving go dependencies
3:08:59 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:08:59 PM: Failing build: Failed to build site
3:08:59 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
3:08:59 PM: Finished processing build request in 40.763842176s

Here are the logs I would get before using @ nuxtjs/style-resources:
10:13:33 AM: Build ready to start
10:13:35 AM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
10:13:35 AM: build-image tag: v3.6.1
10:13:35 AM: buildbot version: 3f7ff7bbf92b8c2ecf180659ea5b1472b472d308
10:13:35 AM: Fetching cached dependencies
10:13:35 AM: Failed to fetch cache, continuing with build
10:13:35 AM: Starting to prepare the repo for build
10:13:36 AM: No cached dependencies found. Cloning fresh repo
10:13:36 AM: git clone git@ bitbucket.org:majdigital/elua-frontend
10:13:39 AM: Preparing Git Reference refs/heads/master
10:13:41 AM: Starting build script
10:13:41 AM: Installing dependencies
10:13:41 AM: Python version set to 2.7
10:13:42 AM: Attempting node version ‘v14.15.5’ from .nvmrc
10:13:43 AM: Downloading and installing node v14.15.5…
10:13:43 AM: Downloading https://nodejs.org/dist/v14.15.5/node-v14.15.5-linux-x64.tar.xz
10:13:44 AM: Computing checksum with sha256sum
10:13:44 AM: Checksums matched!
10:13:48 AM: Now using node v14.15.5 (npm v6.14.11)
10:13:48 AM: Started restoring cached build plugins
10:13:48 AM: Finished restoring cached build plugins
10:13:49 AM: Attempting ruby version 2.7.1, read from environment
10:13:50 AM: Using ruby version 2.7.1
10:13:51 AM: Using PHP version 5.6
10:13:51 AM: Started restoring cached node modules
10:13:51 AM: Finished restoring cached node modules
10:13:51 AM: Installing NPM modules using NPM version 6.14.11
10:14:17 AM: > core-js@ 2.6.12 postinstall /opt/build/repo/node_modules/core-js
10:14:17 AM: > node -e “try{require(’./postinstall’)}catch(e){}”
10:14:18 AM: > nuxt@ 2.15.0 postinstall /opt/build/repo/node_modules/nuxt
10:14:18 AM: > opencollective || exit 0
10:14:20 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@ 1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
10:14:20 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:14:20 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
10:14:20 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:14:20 AM: added 1261 packages from 593 contributors and audited 1384 packages in 27.304s
10:14:21 AM: 78 packages are looking for funding
10:14:21 AM: run npm fund for details
10:14:21 AM: found 0 vulnerabilities
10:14:21 AM: NPM modules installed
10:14:21 AM: Started restoring cached go cache
10:14:21 AM: Finished restoring cached go cache
10:14:21 AM: go version go1.14.4 linux/amd64
10:14:21 AM: go version go1.14.4 linux/amd64
10:14:21 AM: Installing missing commands
10:14:21 AM: Verify run directory
10:14:23 AM: ​
10:14:23 AM: ────────────────────────────────────────────────────────────────
10:14:23 AM: Netlify Build
10:14:23 AM: ────────────────────────────────────────────────────────────────
10:14:23 AM: ​
10:14:23 AM: ❯ Version
10:14:23 AM: @netlify/build 9.1.2
10:14:23 AM: ​
10:14:23 AM: ❯ Flags
10:14:23 AM: deployId: 602e3dcd139216dcd4af40c7
10:14:23 AM: mode: buildbot
10:14:23 AM: ​
10:14:23 AM: ❯ Current directory
10:14:23 AM: /opt/build/repo
10:14:23 AM: ​
10:14:23 AM: ❯ Config file
10:14:23 AM: /opt/build/repo/netlify.toml
10:14:23 AM: ​
10:14:23 AM: ❯ Context
10:14:23 AM: production
10:14:23 AM: ​
10:14:23 AM: ────────────────────────────────────────────────────────────────
10:14:23 AM: 1. Build command from Netlify app
10:14:23 AM: ────────────────────────────────────────────────────────────────
10:14:23 AM: ​
10:14:23 AM: $ npm run generate
10:14:23 AM: > elua-frontend@1.0.0 generate /opt/build/repo
10:14:23 AM: > nuxt generate
10:14:46 AM: [fatal] Nuxt build error
10:14:46 AM: ERROR in ./pages/index.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./pages/index.vue 4:0-66
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./node_modules/.cache/nuxt/App.js
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./node_modules/.cache/nuxt/App.js 27:0-44
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/Delivery.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/Delivery.vue 4:0-69
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/Contact.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/Contact.vue 4:0-68
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/Philosophy.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/Philosophy.vue 4:0-71
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/Meals.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/Meals.vue 4:0-66
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/About.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/About.vue 4:0-66
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/MainHeader.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/MainHeader.vue 4:0-71
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/Hero.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/Hero.vue 4:0-65
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/Collapse.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/Collapse.vue 4:0-93
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./components/Philosophy.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./components/Philosophy.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./components/Philosophy.vue
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/Bowl.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/Bowl.vue 4:0-65
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./components/Meals.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./components/Meals.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./components/Meals.vue
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/CreateBowl.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/CreateBowl.vue 4:0-71
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./components/Meals.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./components/Meals.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./components/Meals.vue
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM: ERROR in ./components/Locales.vue
10:14:46 AM: Module not found: Error: Can’t resolve ‘sass-loader’ in ‘/opt/build/repo’ @ ./components/Locales.vue 3:0-68
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./components/MainHeader.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./components/MainHeader.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./components/MainHeader.vue
10:14:46 AM: @ ./node_modules/babel-loader/lib??ref–2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue?vue&type=script&lang=js&
10:14:46 AM: @ ./pages/index.vue
10:14:46 AM: @ ./node_modules/.cache/nuxt/router.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/index.js
10:14:46 AM: @ ./node_modules/.cache/nuxt/client.js
10:14:46 AM: @ multi ./node_modules/.cache/nuxt/client.js
10:14:46 AM:
10:14:46 AM: ╭─────────────────────────────╮
10:14:46 AM: │ │
10:14:46 AM: │ :heavy_multiplication_x: Nuxt Fatal Error │
10:14:46 AM: │ │
10:14:46 AM: │ Error: Nuxt build error │
10:14:46 AM: │ │
10:14:46 AM: ╰─────────────────────────────╯
10:14:46 AM:
10:14:46 AM: npm ERR! code ELIFECYCLE
10:14:46 AM: npm ERR! errno 1
10:14:46 AM: npm ERR! elua-frontend@1.0.0 generate: nuxt generate
10:14:46 AM: npm ERR! Exit status 1
10:14:46 AM: npm ERR!
10:14:46 AM: npm ERR! Failed at the elua-frontend@1.0.0 generate script.
10:14:46 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:14:46 AM: npm ERR! A complete log of this run can be found in:
10:14:46 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-02-18T10_14_46_534Z-debug.log
10:14:46 AM: ​
10:14:46 AM: ────────────────────────────────────────────────────────────────
10:14:46 AM: “build.command” failed
10:14:46 AM: ────────────────────────────────────────────────────────────────
10:14:46 AM: ​
10:14:46 AM: Error message
10:14:46 AM: Command failed with exit code 1: npm run generate
10:14:46 AM: ​
10:14:46 AM: Error location
10:14:46 AM: In Build command from Netlify app:
10:14:46 AM: npm run generate
10:14:46 AM: ​
10:14:46 AM: Resolved config
10:14:46 AM: build:
10:14:46 AM: command: npm run generate
10:14:46 AM: commandOrigin: ui
10:14:46 AM: environment:
10:14:46 AM: - NODE_ENV
10:14:46 AM: - API_URL
10:14:46 AM: publish: /opt/build/repo/dist
10:14:46 AM: Caching artifacts
10:14:46 AM: Started saving node modules
10:14:46 AM: Finished saving node modules
10:14:46 AM: Started saving build plugins
10:14:46 AM: Finished saving build plugins
10:14:46 AM: Started saving pip cache
10:14:46 AM: Finished saving pip cache
10:14:46 AM: Started saving emacs cask dependencies
10:14:46 AM: Finished saving emacs cask dependencies
10:14:46 AM: Started saving maven dependencies
10:14:46 AM: Finished saving maven dependencies
10:14:46 AM: Started saving boot dependencies
10:14:46 AM: Finished saving boot dependencies
10:14:46 AM: Started saving rust rustup cache
10:14:46 AM: Finished saving rust rustup cache
10:14:46 AM: Started saving go dependencies
10:14:46 AM: Finished saving go dependencies
10:14:50 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:14:50 AM: Failing build: Failed to build site
10:14:50 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
10:14:50 AM: Finished processing build request in 1m15.378193974s

The issue was coming from this:

And the NODE_ENV was set to production in my case. So as the module was referenced as a dev dependency, it was not installed. I just renamed this env variable and it’s working now.

Hello @Mickael_Chanrion :wave:

Welcome to the Netlify community! I see that you have resolved the original issue you posted. Thank you so much for sharing your resolution, as well as your very detailed original post. Sharing solutions will help future users work through similar questions, so we really appreciate it.

Again, welcome to the community! :netliconfetti: