Netlify auto-deploy from github uses old files

PLEASE help us help you by writing a good post!

  • we need to know your netlify site name. Example: gifted-antelope-58b104.netlify.app

celadon-maamoul-adad52

  • DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
  • Build problems? Link or paste the FULL build log & build settings screenshot
12:34:25 AM: Build ready to start
12:34:29 AM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
12:34:29 AM: build-image tag: v4.10.1
12:34:29 AM: buildbot version: 37262c48b1f3cfa88c6caed707d29b19aef6a5a7
12:34:29 AM: Fetching cached dependencies
12:34:29 AM: Starting to download cache of 944.3MB
12:34:36 AM: Finished downloading cache in 7.166949463s
12:34:36 AM: Starting to extract cache
12:34:42 AM: Finished extracting cache in 5.886686902s
12:34:42 AM: Finished fetching cache in 13.174424852s
12:34:42 AM: Starting to prepare the repo for build
12:34:42 AM: Preparing Git Reference refs/heads/master
12:34:44 AM: Parsing package.json dependencies
12:34:45 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'packages/nelf-raise2change-app/dist' versus 'dist' in the Netlify UI
12:34:45 AM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'exit 1'
12:34:45 AM: Starting build script
12:34:45 AM: Installing dependencies
12:34:45 AM: Python version set to 2.7
12:34:45 AM: Started restoring cached node version
12:34:46 AM: Finished restoring cached node version
12:34:46 AM: v16.17.0 is already installed.
12:34:47 AM: Now using node v16.17.0 (npm v8.15.0)
12:34:47 AM: Started restoring cached build plugins
12:34:47 AM: Finished restoring cached build plugins
12:34:47 AM: Attempting ruby version 2.7.2, read from environment
12:34:47 AM: Using ruby version 2.7.2
12:34:48 AM: Using PHP version 8.0
12:34:48 AM: Started restoring cached yarn cache
12:34:51 AM: Finished restoring cached yarn cache
12:34:52 AM: yarn workspaces detected
12:34:52 AM: Started restoring workspace packages/common node modules
12:34:52 AM: Finished restoring workspace packages/common node modules
12:34:52 AM: Started restoring workspace packages/nelf-raise2change-app node modules
12:34:52 AM: Finished restoring workspace packages/nelf-raise2change-app node modules
12:34:52 AM: Started restoring workspace root node modules
12:34:52 AM: Finished restoring workspace root node modules
12:34:52 AM: Installing NPM modules using Yarn version 1.22.10
12:34:52 AM: npm ERR! code ENOWORKSPACES
12:34:52 AM: npm ERR! This command does not support workspaces.
12:34:52 AM: npm ERR! A complete log of this run can be found in:
12:34:52 AM: npm ERR!     /opt/buildhome/.npm/_logs/2022-09-14T07_34_52_816Z-debug-0.log
12:34:52 AM: yarn install v1.22.10
12:34:53 AM: [1/4] Resolving packages...
12:34:53 AM: success Already up-to-date.
12:34:53 AM: Done in 0.73s.
12:34:53 AM: NPM modules installed using Yarn
12:34:53 AM: Started restoring cached go cache
12:34:53 AM: Finished restoring cached go cache
12:34:53 AM: Installing Go version 1.17 (requested 1.17)
12:34:58 AM: unset GOOS;
12:34:58 AM: unset GOARCH;
12:34:58 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
12:34:58 AM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
12:34:58 AM: go version >&2;
12:34:58 AM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
12:34:58 AM: go version go1.17 linux/amd64
12:34:58 AM: Installing missing commands
12:34:58 AM: Verify run directory
12:34:59 AM: ​
12:34:59 AM: ────────────────────────────────────────────────────────────────
12:34:59 AM:   Netlify Build                                                 
12:34:59 AM: ────────────────────────────────────────────────────────────────
12:34:59 AM: ​
12:34:59 AM: ❯ Version
12:34:59 AM:   @netlify/build 27.17.1
12:34:59 AM: ​
12:34:59 AM: ❯ Flags
12:34:59 AM:   baseRelDir: true
12:34:59 AM:   buildId: 632183ddc852040008137b35
12:34:59 AM:   deployId: 632183ddc852040008137b37
12:34:59 AM: ​
12:34:59 AM: ❯ Current directory
12:34:59 AM:   /opt/build/repo/packages/nelf-raise2change-app
12:34:59 AM: ​
12:34:59 AM: ❯ Config file
12:34:59 AM:   /opt/build/repo/packages/nelf-raise2change-app/netlify.toml
12:34:59 AM: ​
12:34:59 AM: ❯ Context
12:34:59 AM:   production
12:34:59 AM: ​
12:34:59 AM: ────────────────────────────────────────────────────────────────
12:34:59 AM:   1. Build command from Netlify app                             
12:34:59 AM: ────────────────────────────────────────────────────────────────
12:34:59 AM: ​
12:34:59 AM: $ rm -rf dist/ && yarn generate-production
12:34:59 AM: yarn run v1.22.10
12:34:59 AM: $ nuxt generate --dotenv .env.production
12:35:01 AM: Done in 1.59s.
12:35:01 AM: ​
12:35:01 AM: (build.command completed in 1.7s)
12:35:01 AM: ​
12:35:01 AM: ────────────────────────────────────────────────────────────────
12:35:01 AM:   2. Deploy site                                                
12:35:01 AM: ────────────────────────────────────────────────────────────────
12:35:01 AM: ​
12:35:01 AM: Starting to deploy site from 'packages/nelf-raise2change-app/dist'
12:35:01 AM: Creating deploy tree 
12:35:01 AM: Creating deploy upload records
12:35:01 AM: 0 new files to upload
12:35:01 AM: 0 new functions to upload
12:35:01 AM: Site deploy was successfully initiated
12:35:01 AM: ​
12:35:01 AM: Starting post processing
12:35:01 AM: (Deploy site completed in 490ms)
12:35:01 AM: ​
12:35:01 AM: Skipping HTML post processing
12:35:01 AM: ────────────────────────────────────────────────────────────────
12:35:01 AM:   Netlify Build Complete                                        
12:35:01 AM: ────────────────────────────────────────────────────────────────
12:35:02 AM: Post processing - header rules
12:35:01 AM: ​
12:35:01 AM: (Netlify Build completed in 2.2s)
12:35:01 AM: Caching artifacts
12:35:02 AM: Post processing - redirect rules
12:35:01 AM: Started saving workspace packages/common node modules
12:35:01 AM: Finished saving workspace packages/common node modules
12:35:01 AM: Started saving workspace packages/nelf-raise2change-app node modules
12:35:01 AM: Finished saving workspace packages/nelf-raise2change-app node modules
12:35:02 AM: Post processing done
12:35:01 AM: Started saving workspace root node modules
12:35:01 AM: Finished saving workspace root node modules
12:35:01 AM: Started saving build plugins
12:35:01 AM: Finished saving build plugins
12:35:01 AM: Started saving yarn cache
12:35:05 AM: Finished saving yarn cache
12:35:05 AM: Started saving pip cache
12:35:05 AM: Finished saving pip cache
12:35:05 AM: Started saving emacs cask dependencies
12:35:05 AM: Finished saving emacs cask dependencies
12:35:05 AM: Started saving maven dependencies
12:35:05 AM: Finished saving maven dependencies
12:35:05 AM: Started saving boot dependencies
12:35:06 AM: Finished saving boot dependencies
12:35:06 AM: Started saving rust rustup cache
12:35:06 AM: Finished saving rust rustup cache
12:35:06 AM: Started saving go dependencies
12:35:06 AM: Finished saving go dependencies
12:35:06 AM: Build script success
12:35:07 AM: Site is live ✨
12:35:10 AM: Uploading Cache of size 945.0MB
12:35:16 AM: Finished processing build request in 47.472862787s

However some files that I modified wasn’t updated after this, I had to choose “clear cache and retry deploy” then those changes show up on the website.

I already did “rm -rf dist/ && yarn build” the issue still persist

The better the post - the faster the answer.

I figured out, it is partially my fault

  1. I had some monorepo and some shared code, the shared code is packaged as a package depenedncy
  2. Netlify by default caches node_modules which I am relying on to load the shared code
  3. By purging the node_modules cache the changes in shared code will be shown in build
  4. I workaround by adding yarn install in build command as a safeguard