Home
Support Forums

Nuxt JS Static Sites all failing to build on npm run generate

Hello,

All of my Nuxt JS sites are failing to build recently.

Build settings:

Log below:

1:00:09 PM: Build ready to start
1:00:11 PM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
1:00:11 PM: build-image tag: v3.6.1
1:00:11 PM: buildbot version: 52e88d4737b20536efcd50639fdcd98a91b0d98c
1:00:11 PM: Fetching cached dependencies
1:00:11 PM: Starting to download cache of 218.7MB
1:00:13 PM: Finished downloading cache in 2.368871776s
1:00:13 PM: Starting to extract cache
1:00:25 PM: Finished extracting cache in 11.288126581s
1:00:25 PM: Finished fetching cache in 13.834997794s
1:00:25 PM: Starting to prepare the repo for build
1:00:25 PM: Preparing Git Reference refs/heads/main
1:00:28 PM: Starting build script
1:00:28 PM: Installing dependencies
1:00:28 PM: Python version set to 2.7
1:00:29 PM: Started restoring cached node version
1:00:35 PM: Finished restoring cached node version
1:00:36 PM: v10.24.0 is already installed.
1:00:37 PM: Now using node v10.24.0 (npm v6.14.11)
1:00:37 PM: Started restoring cached build plugins
1:00:37 PM: Finished restoring cached build plugins
1:00:37 PM: Attempting ruby version 2.7.1, read from environment
1:00:39 PM: Using ruby version 2.7.1
1:00:39 PM: Using PHP version 5.6
1:00:39 PM: Started restoring cached node modules
1:00:39 PM: Finished restoring cached node modules
1:00:39 PM: Started restoring cached yarn cache
1:00:39 PM: Finished restoring cached yarn cache
1:00:40 PM: Installing NPM modules using Yarn version 1.22.4
1:00:41 PM: yarn install v1.22.4
1:00:41 PM: [1/4] Resolving packagesโ€ฆ
1:00:42 PM: warning bootstrap-vue > popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
1:00:43 PM: warning nuxt > @nuxt/static@1.0.0: this feature has been moved to the core. you can directly use nuxt generate
1:00:43 PM: warning nuxt > @nuxt/cli > @nuxt/static@1.0.0: this feature has been moved to the core. you can directly use nuxt generate
1:00:44 PM: warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
1:00:45 PM: [2/4] Fetching packagesโ€ฆ
1:01:06 PM: info fsevents@2.3.2: The platform โ€œlinuxโ€ is incompatible with this module.
1:01:06 PM: info โ€œfsevents@2.3.2โ€ is an optional dependency and failed compatibility check. Excluding it from installation.
1:01:06 PM: info fsevents@1.2.9: The platform โ€œlinuxโ€ is incompatible with this module.
1:01:06 PM: info โ€œfsevents@1.2.9โ€ is an optional dependency and failed compatibility check. Excluding it from installation.
1:01:06 PM: [3/4] Linking dependenciesโ€ฆ
1:01:06 PM: warning " > bootstrap@4.5.3" has unmet peer dependency โ€œjquery@1.9.1 - 3โ€.
1:01:06 PM: warning " > bootstrap@4.5.3" has unmet peer dependency โ€œpopper.js@^1.16.1โ€.
1:01:06 PM: warning โ€œbootstrap-vue > bootstrap@4.6.0โ€ has unmet peer dependency โ€œjquery@1.9.1 - 3โ€.
1:01:06 PM: warning " > vuex-persistedstate@4.0.0-beta.3" has unmet peer dependency โ€œvuex@^3.0 || ^4.0.0-rcโ€.
1:01:06 PM: warning " > sass-loader@8.0.0" has unmet peer dependency โ€œwebpack@^4.36.0โ€.
1:01:18 PM: [4/4] Building fresh packagesโ€ฆ
1:01:21 PM: success Saved lockfile.
1:01:21 PM: Done in 40.23s.
1:01:21 PM: NPM modules installed using Yarn
1:01:22 PM: Started restoring cached go cache
1:01:22 PM: Finished restoring cached go cache
1:01:22 PM: go version go1.14.4 linux/amd64
1:01:22 PM: go version go1.14.4 linux/amd64
1:01:22 PM: Installing missing commands
1:01:22 PM: Verify run directory
1:01:24 PM: โ€‹
1:01:24 PM: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1:01:24 PM: Netlify Build
1:01:24 PM: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1:01:24 PM: โ€‹
1:01:24 PM: โฏ Version
1:01:24 PM: @netlify/build 9.3.0
1:01:24 PM: โ€‹
1:01:24 PM: โฏ Flags
1:01:24 PM: deployId: 6037e5a91e6300000731b4e5
1:01:24 PM: mode: buildbot
1:01:24 PM: โ€‹
1:01:24 PM: โฏ Current directory
1:01:24 PM: /opt/build/repo
1:01:24 PM: โ€‹
1:01:24 PM: โฏ Config file
1:01:24 PM: /opt/build/repo/netlify.toml
1:01:24 PM: โ€‹
1:01:24 PM: โฏ Context
1:01:24 PM: production
1:01:24 PM: โ€‹
1:01:24 PM: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1:01:24 PM: 1. build.command from netlify.toml
1:01:24 PM: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1:01:24 PM: โ€‹
1:01:24 PM: $ npm run generate
1:01:24 PM: > ece-circuit@1.0.0 generate /opt/build/repo
1:01:24 PM: > nuxt generate
1:01:26 PM: [warn] mode option is deprecated. You can safely remove it from nuxt.config
1:01:34 PM: [fatal] Nuxt build error
1:01:34 PM: ERROR in ./node_modules/.cache/nuxt/client.js
1:01:34 PM: Module build failed (from ./node_modules/babel-loader/lib/index.js):
1:01:34 PM: node_modules/@nuxt/babel-preset-app/src/polyfills-plugin.js:1
1:01:34 PM: Error: node_modules/.cache/nuxt/client.js: Cannot find module โ€˜@babel/preset-env/lib/utilsโ€™
1:01:34 PM: Require stack:
1:01:34 PM: - node_modules/@nuxt/babel-preset-app/src/polyfills-plugin.js
1:01:34 PM: - node_modules/@nuxt/babel-preset-app/src/index.js
1:01:34 PM: - node_modules/@babel/core/lib/config/files/module-types.js
1:01:34 PM: - node_modules/@babel/core/lib/config/files/configuration.js
1:01:34 PM: - node_modules/@babel/core/lib/config/files/index.js
1:01:34 PM: - node_modules/@babel/core/lib/index.js
1:01:34 PM: - node_modules/babel-loader/lib/index.js
1:01:34 PM: - node_modules/loader-runner/lib/loadLoader.js
1:01:34 PM: - node_modules/loader-runner/lib/LoaderRunner.js
1:01:34 PM: - node_modules/webpack/lib/NormalModule.js
1:01:34 PM: - node_modules/webpack/lib/NormalModuleFactory.js
1:01:34 PM: - node_modules/webpack/lib/Compiler.js
1:01:34 PM: - node_modules/webpack/lib/webpack.js
1:01:34 PM: - nuxt.config.js
1:01:34 PM: - node_modules/@nuxt/config/dist/config.js
1:01:34 PM: - node_modules/@nuxt/cli/dist/cli-index.js
1:01:34 PM: - node_modules/@nuxt/cli/dist/cli.js
1:01:34 PM: - node_modules/nuxt/bin/nuxt.js
1:01:34 PM: at PluginPass.Program (node_modules/@nuxt/babel-preset-app/src/polyfills-plugin.js:15:34)
1:01:34 PM: at newFn (node_modules/@babel/traverse/lib/visitors.js:175:21)
1:01:34 PM: at NodePath._call (node_modules/@babel/traverse/lib/path/context.js:55:20)
1:01:34 PM: at NodePath.call (node_modules/@babel/traverse/lib/path/context.js:42:17)
1:01:34 PM: at NodePath.visit (node_modules/@babel/traverse/lib/path/context.js:92:31)
1:01:34 PM: at TraversalContext.visitQueue (node_modules/@babel/traverse/lib/context.js:116:16)
1:01:34 PM: at TraversalContext.visitSingle (node_modules/@babel/traverse/lib/context.js:85:19)
1:01:34 PM: at TraversalContext.visit (node_modules/@babel/traverse/lib/context.js:144:19)
1:01:34 PM: at Function.traverse.node (node_modules/@babel/traverse/lib/index.js:82:17)
1:01:34 PM: at traverse (node_modules/@babel/traverse/lib/index.js:62:12)
1:01:34 PM: @ multi ./node_modules/.cache/nuxt/client.js app[0]
1:01:34 PM: tput: No value for $TERM and no -T specified
1:01:34 PM:
1:01:34 PM: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
1:01:34 PM: โ”‚ โ”‚
1:01:34 PM: โ”‚ :heavy_multiplication_x: Nuxt Fatal Error โ”‚
1:01:34 PM: โ”‚ โ”‚
1:01:34 PM: โ”‚ Error: Nuxt build error โ”‚
1:01:34 PM: โ”‚ โ”‚
1:01:34 PM: โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
1:01:34 PM:
1:01:34 PM: npm ERR! code ELIFECYCLE
1:01:34 PM: npm ERR! errno 1
1:01:34 PM: npm ERR! ece-circuit@1.0.0 generate: nuxt generate
1:01:34 PM: npm ERR! Exit status 1
1:01:34 PM: npm ERR!
1:01:34 PM: npm ERR! Failed at the ece-circuit@1.0.0 generate script.
1:01:34 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1:01:34 PM: npm ERR! A complete log of this run can be found in:
1:01:34 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-02-25T18_01_34_886Z-debug.log
1:01:34 PM: โ€‹
1:01:34 PM: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1:01:34 PM: โ€œbuild.commandโ€ failed
1:01:34 PM: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1:01:34 PM: โ€‹
1:01:34 PM: Error message
1:01:34 PM: Command failed with exit code 1: npm run generate
1:01:34 PM: โ€‹
1:01:34 PM: Error location
1:01:34 PM: In build.command from netlify.toml:
1:01:34 PM: npm run generate
1:01:34 PM: โ€‹
1:01:34 PM: Resolved config
1:01:34 PM: build:
1:01:34 PM: command: npm run generate
1:01:34 PM: commandOrigin: config
1:01:34 PM: environment:
1:01:34 PM: - NODE_VERSION
1:01:34 PM: functions: /opt/build/repo/my_functions
1:01:34 PM: publish: /opt/build/repo/dist
1:01:35 PM: Caching artifacts
1:01:35 PM: Started saving node modules
1:01:35 PM: Finished saving node modules
1:01:35 PM: Started saving build plugins
1:01:35 PM: Finished saving build plugins
1:01:35 PM: Started saving yarn cache
1:01:35 PM: Finished saving yarn cache
1:01:35 PM: Started saving pip cache
1:01:35 PM: Finished saving pip cache
1:01:35 PM: Started saving emacs cask dependencies
1:01:35 PM: Finished saving emacs cask dependencies
1:01:35 PM: Started saving maven dependencies
1:01:35 PM: Finished saving maven dependencies
1:01:35 PM: Started saving boot dependencies
1:01:35 PM: Finished saving boot dependencies
1:01:35 PM: Started saving rust rustup cache
1:01:35 PM: Finished saving rust rustup cache
1:01:35 PM: Started saving go dependencies
1:01:35 PM: Finished saving go dependencies
1:01:35 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:01:35 PM: Failing build: Failed to build site
1:01:35 PM: Failed during stage โ€˜building siteโ€™: Build script returned non-zero exit code: 2
1:01:35 PM: Finished processing build request in 1m24.223042509s

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - itโ€™s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

Thanks, I am reviewing the support guide now.

Building settings per toml file:

[build]
publish = โ€œdistโ€
command = โ€œCI= npm run generateโ€
[build.environment]
NODE_VERSION = โ€œ10โ€

Build settings on the Netlify UI:

Build command = npm run generate
Publish directory = dist
Builds = Active
NODE_VERSION = 10

Packagage.json:

{
โ€œnameโ€: โ€œsite nameโ€,
โ€œversionโ€: โ€œ1.0.0โ€,
โ€œdescriptionโ€: โ€œdescription hereโ€,
โ€œauthorโ€: โ€œโ€,
โ€œprivateโ€: true,
โ€œscriptsโ€: {
โ€œdevโ€: โ€œnuxtโ€,
โ€œbuildโ€: โ€œnuxt buildโ€,
โ€œstartโ€: โ€œnuxt startโ€,
โ€œgenerateโ€: โ€œnuxt generateโ€
},
โ€œdependenciesโ€: {
โ€œ@nuxtjs/authโ€: โ€œ^4.9.1โ€,
โ€œ@nuxtjs/axiosโ€: โ€œ^5.11.0โ€,
โ€œ@nuxtjs/sitemapโ€: โ€œ^2.4.0โ€,
โ€œaxiosโ€: โ€œ^0.19.0โ€,
โ€œbootstrapโ€: โ€œ4.5.3โ€,
โ€œbootstrap-vueโ€: โ€œ^2.17.0โ€,
โ€œnuxtโ€: โ€œ2.14.6โ€,
โ€œvueโ€: โ€œ2.6.12โ€,
โ€œvuex-persistedstateโ€: โ€œ^4.0.0-beta.1โ€
},
โ€œdevDependenciesโ€: {
โ€œnode-sassโ€: โ€œ^4.12.0โ€,
โ€œsass-loaderโ€: โ€œ^8.0.0โ€
}
}

I got this particular site working

I switched Node to use Version 12 in my toml file

[build.environment]
NODE_VERSION = โ€œ12โ€

This is weird because all of my Nuxt Static sites were working with v10 and no major changes or addons made and they are breaking. This works for now.

Got the idea because another thread they switched to a newer version of Node and it built.

No idea why, but if youโ€™re struggling with Nuxt JS builds failing on Netlify and they are working locally, try switching your node versions or watching for packages incompatible with your node versions (wasnโ€™t my case but I did see warnings of some packages not working with Node v14)