Netlify build fails on previously successful commit - Vuepress build failure

Netlify site name: learnroadrunner (www.learnroadrunner.com)
GitHub - NoahBres/LearnRoadRunner: Learn Road Runner

Netlify has been failing to build my vuepress site. My site builds locally without issue.

My last successful build was on May. 10 and I have not touched the site since. However, upon picking the project back up today, I am finding that none of my builds have been successful.

I thought it was simply an issue with the dependencies so made a few attempts to fix that. However, the latest deploy was a commit reverting back to the original successful publish. The latest deploy at 5:13 is the commit hash for the same deploy on May. 10. So these two states are identical. However, the build today fails. I am assuming something has changed with the build image since then.

Thank you all for the wonderful product!

Here is the build log for the latest deploy:

5:13:16 PM: Build ready to start
5:13:18 PM: build-image version: 2cee85eb7f808bf3b6e87378c5307f9411f0a332
5:13:18 PM: build-image tag: v3.8.0
5:13:18 PM: buildbot version: 3b0c079a2e52aae070f2433b3231592eec65b71e
5:13:19 PM: Fetching cached dependencies
5:13:19 PM: Failed to fetch cache, continuing with build
5:13:19 PM: Starting to prepare the repo for build
5:13:19 PM: No cached dependencies found. Cloning fresh repo
5:13:19 PM: git clone https://github.com/NoahBres/LearnRoadRunner
5:13:31 PM: Preparing Git Reference refs/heads/master
5:13:33 PM: Parsing package.json dependencies
5:13:33 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'docs/.vuepress/dist' versus './docs/.vuepress/dist' in the Netlify UI
5:13:34 PM: Starting build script
5:13:34 PM: Installing dependencies
5:13:34 PM: Python version set to 2.7
5:13:35 PM: Downloading and installing node v14.17.1...
5:13:35 PM: Downloading https://nodejs.org/dist/v14.17.1/node-v14.17.1-linux-x64.tar.xz...
5:13:36 PM: Computing checksum with sha256sum
5:13:36 PM: Checksums matched!
5:13:40 PM: Now using node v14.17.1 (npm v6.14.13)
5:13:40 PM: Started restoring cached build plugins
5:13:40 PM: Finished restoring cached build plugins
5:13:40 PM: Attempting ruby version 2.6.2, read from environment
5:13:42 PM: Using ruby version 2.6.2
5:13:42 PM: Using PHP version 5.6
5:13:42 PM: Started restoring cached node modules
5:13:42 PM: Finished restoring cached node modules
5:13:43 PM: Installing NPM modules using NPM version 6.14.13
5:14:12 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
5:14:12 PM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
5:14:12 PM: > node -e "try{require('./postinstall')}catch(e){}"
5:14:12 PM: > core-js@3.10.1 postinstall /opt/build/repo/node_modules/core-js
5:14:12 PM: > node -e "try{require('./postinstall')}catch(e){}"
5:14:13 PM: > vuepress@1.8.2 postinstall /opt/build/repo/node_modules/vuepress
5:14:13 PM: > opencollective-postinstall || exit 0
5:14:14 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/watchpack/node_modules/fsevents):
5:14:14 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:14:14 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
5:14:14 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:14:14 PM: added 1319 packages from 575 contributors and audited 1409 packages in 30.615s
5:14:15 PM: 69 packages are looking for funding
5:14:15 PM:   run `npm fund` for details
5:14:15 PM: found 94 vulnerabilities (88 moderate, 6 high)
5:14:15 PM:   run `npm audit fix` to fix them, or `npm audit` for details
5:14:15 PM: NPM modules installed
5:14:16 PM: Started restoring cached go cache
5:14:16 PM: Finished restoring cached go cache
5:14:16 PM: Installing Go version 1.12
5:14:21 PM: unset GOOS;
5:14:21 PM: unset GOARCH;
5:14:21 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
5:14:21 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
5:14:21 PM: go version >&2;
5:14:21 PM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
5:14:21 PM: go version go1.12 linux/amd64
5:14:21 PM: Installing missing commands
5:14:21 PM: Verify run directory
5:14:22 PM: ​
5:14:22 PM: ────────────────────────────────────────────────────────────────
5:14:22 PM:   Netlify Build                                                 
5:14:22 PM: ────────────────────────────────────────────────────────────────
5:14:22 PM: ​
5:14:22 PM: ❯ Version
5:14:22 PM:   @netlify/build 12.7.1
5:14:22 PM: ​
5:14:22 PM: ❯ Flags
5:14:22 PM:   deployId: 60d2607cff9b8100072a1d00
5:14:22 PM: ​
5:14:22 PM: ❯ Current directory
5:14:22 PM:   /opt/build/repo
5:14:22 PM: ​
5:14:22 PM: ❯ Config file
5:14:22 PM:   No config file was defined: using default values.
5:14:22 PM: ​
5:14:22 PM: ❯ Context
5:14:22 PM:   production
5:14:22 PM: ​
5:14:22 PM: ────────────────────────────────────────────────────────────────
5:14:22 PM:   1. Build command from Netlify app                             
5:14:22 PM: ────────────────────────────────────────────────────────────────
5:14:22 PM: ​
5:14:22 PM: $ npm run build
5:14:23 PM: > learn-road-runner@1.0.0 build /opt/build/repo
5:14:23 PM: > vuepress build docs
5:14:23 PM: internal/modules/cjs/loader.js:905
5:14:23 PM:   throw err;
5:14:23 PM:   ^
5:14:23 PM: Error: Cannot find module 'lru-cache'
5:14:23 PM: Require stack:
5:14:23 PM: - /opt/build/repo/node_modules/@vuepress/shared-utils/lib/extractHeaders.js
5:14:23 PM: - /opt/build/repo/node_modules/@vuepress/shared-utils/lib/index.js
5:14:23 PM: - /opt/build/repo/node_modules/vuepress/lib/checkEnv.js
5:14:23 PM: - /opt/build/repo/node_modules/vuepress/cli.js
5:14:23 PM:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
5:14:23 PM:     at Function.Module._load (internal/modules/cjs/loader.js:746:27)
5:14:23 PM:     at Module.require (internal/modules/cjs/loader.js:974:19)
5:14:23 PM:     at require (internal/modules/cjs/helpers.js:92:18)
5:14:23 PM:     at Object.<anonymous> (/opt/build/repo/node_modules/@vuepress/shared-utils/lib/extractHeaders.js:5:37)
5:14:23 PM:     at Module._compile (internal/modules/cjs/loader.js:1085:14)
5:14:23 PM:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
5:14:23 PM:     at Module.load (internal/modules/cjs/loader.js:950:32)
5:14:23 PM:     at Function.Module._load (internal/modules/cjs/loader.js:790:14)
5:14:23 PM:     at Module.require (internal/modules/cjs/loader.js:974:19) {
5:14:23 PM:   code: 'MODULE_NOT_FOUND',
5:14:23 PM:   requireStack: [
5:14:23 PM:     '/opt/build/repo/node_modules/@vuepress/shared-utils/lib/extractHeaders.js',
5:14:23 PM:     '/opt/build/repo/node_modules/@vuepress/shared-utils/lib/index.js',
5:14:23 PM:     '/opt/build/repo/node_modules/vuepress/lib/checkEnv.js',
5:14:23 PM:     '/opt/build/repo/node_modules/vuepress/cli.js'
5:14:23 PM:   ]
5:14:23 PM: }
5:14:23 PM: npm ERR! code ELIFECYCLE
5:14:23 PM: npm ERR! errno 1
5:14:23 PM: npm ERR! learn-road-runner@1.0.0 build: `vuepress build docs`
5:14:23 PM: npm ERR! Exit status 1
5:14:23 PM: npm ERR!
5:14:23 PM: npm ERR! Failed at the learn-road-runner@1.0.0 build script.
5:14:23 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
5:14:23 PM: npm ERR! A complete log of this run can be found in:
5:14:23 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-06-22T22_14_23_299Z-debug.log
5:14:23 PM: ​
5:14:23 PM: ────────────────────────────────────────────────────────────────
5:14:23 PM:   "build.command" failed                                        
5:14:23 PM: ────────────────────────────────────────────────────────────────
5:14:23 PM: ​
5:14:23 PM:   Error message
5:14:23 PM:   Command failed with exit code 1: npm run build
5:14:23 PM: ​
5:14:23 PM:   Error location
5:14:23 PM:   In Build command from Netlify app:
5:14:23 PM:   npm run build
5:14:23 PM: ​
5:14:23 PM:   Resolved config
5:14:23 PM:   build:
5:14:23 PM:     command: npm run build
5:14:23 PM:     commandOrigin: ui
5:14:23 PM:     environment:
5:14:23 PM:       - NODE_ENV
5:14:23 PM:       - NODE_VERSION
5:14:23 PM:     publish: /opt/build/repo/docs/.vuepress/dist
5:14:23 PM:     publishOrigin: ui
5:14:23 PM:   functions:
5:14:23 PM:     '*': {}
5:14:23 PM: Caching artifacts
5:14:23 PM: Started saving node modules
5:14:23 PM: Finished saving node modules
5:14:23 PM: Started saving build plugins
5:14:23 PM: Finished saving build plugins
5:14:23 PM: Started saving pip cache
5:14:23 PM: Finished saving pip cache
5:14:23 PM: Started saving emacs cask dependencies
5:14:23 PM: Finished saving emacs cask dependencies
5:14:23 PM: Started saving maven dependencies
5:14:23 PM: Finished saving maven dependencies
5:14:23 PM: Started saving boot dependencies
5:14:23 PM: Finished saving boot dependencies
5:14:23 PM: Started saving rust rustup cache
5:14:23 PM: Finished saving rust rustup cache
5:14:24 PM: Started saving go dependencies
5:14:25 PM: Finished saving go dependencies
5:14:29 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:14:29 PM: Creating deploy upload records
5:14:29 PM: Failing build: Failed to build site
5:14:29 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
5:14:29 PM: Finished processing build request in 1m10.871416048s

This specific issue is ameliorated when explicitly installing the lru-cache dependency. However, that simply leads to more errors. I can post those logs if it helps.

hi there, i am wondering if one of your dependencies has changed behind the scenes. that would explain why it would work locally (with a working configuration) and fail when you try and deploy (for some reason, when we fetch your dependencies, it dies).

What happens when you delete your local node_modules and try and run things locally after running npm install? if my hunch is correct it should fail. you can then work on upgrading your local dependencies until things work locally again, and then make sure you commit the package-lock file so that we mirror your local environment on our servers.

I have zero issues after wiping the local node_modules and running locally!

ok cool. did you commit your package-lock file? make sure you do, then try a clear cache and redeploy, and we’ll see if that helps.

Yep. Already tried that.

Also I can rid of the dependency issues. That’s not the primary issue. I have tried adding the dependencies specified to package.json. That solves the dependency specific issues (even though they shouldn’t really be occurring in the first place as it did not happen in the identical May commit nor does it happen locally).
However, if I fix the dependencies, it breaks one of the loaders. Typescript completely falls apart it seems.

Hi there, @NoahBres :wave:

It looks like this thread has been quiet for the past week or so. Thanks for your patience! Have you made any progress on this? Let us know what additional troubleshooting steps you have taken or if you have made any changes :slight_smile:

Thank you :D. Unfortunately not! It’s been at a standstill thus far! Not really sure what else I could do.

Hi @NoahBres,

This is strange indeed. I was able to clone your repo and deploy it. I did face some issues with package versions, but yeah, could get it working, here’s the website: https://distracted-lalande-da567b.netlify.app and the repo: https://github.com/Hrishikesh-K/learnroadrunner.

Some stuff to note: I’m using latest Node by setting NODE_VERSION environment variable as node. Not sure if that makes a difference.

It might also be possible that I was able to deploy because it’s a fresh website and in that case, you might have to delete your current website and create another one to see if it helps. Not the best thing to do, but might help.

1 Like

Deleting the site and creating a fresh site did work!

I did not want to do that originally as I had an analytics subscription on there. But it does work now! Thank you!