Home
Support Forums

Deploy failing but local working, after local package updates

Recently was doing some local clean up, updated npm, updated netlify-cli, and a few other local packages. Nothing that i thought would have affected the build or even the dependencies in the project. But now deployment is failing. The reason in this log seems to be “chalk” from the sanity dependency, not sure why this is breaking now…

site: https://faceoffspot.netlify.app/

dependancies:

"dependencies": {
    "@nuxt/content": "^1.8.1",
    "@nuxtjs/axios": "^5.12.2",
    "@nuxtjs/feed": "^2.0.0",
    "@nuxtjs/gtm": "^2.3.2",
    "@nuxtjs/pwa": "^3.0.2",
    "@nuxtjs/redirect-module": "^0.3.1",
    "@nuxtjs/sanity": "^0.10.0",
    "@nuxtjs/sitemap": "^2.4.0",
    "@sanity/client": "^2.11.0",
    "@sanity/image-url": "^0.140.22",
    "@silvanite/vue-instagram": "^1.0.0",
    "axios": "^0.21.1",
    "bootstrap-vue": "^2.17.3",
    "core-js": "^3.6.5",
    "date-fns": "^2.22.1",
    "jquery": "^3.5.1",
    "jquery-slim": "^3.0.0",
    "node-sass": "^5.0.0",
    "nuxt": "^2.14.5",
    "nuxt-logrocket": "^1.5.2",
    "plyr": "^3.4.7",
    "sass-loader": "^10.1.0",
    "vue-analytics": "^5.22.1",
    "vue-disqus": "^4.0.1",
    "vue-playr": "^0.1.1",
    "vuetify": "^2.5.0"
  },
  "devDependencies": {
    "@nuxtjs/google-analytics": "^2.4.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-prettier": "^3.1.4",
    "prettier": "^2.1.1"
  }

log:

2:37:39 PM: Build ready to start
2:37:41 PM: build-image version: c6001ed68662a13e5deb24abec2b46058c58248a
2:37:41 PM: build-image tag: v3.9.0
2:37:41 PM: buildbot version: b804dff13c52d65303f0ba1445af1695479d4e08
2:37:41 PM: Building without cache
2:37:41 PM: Starting to prepare the repo for build
2:37:42 PM: No cached dependencies found. Cloning fresh repo
2:37:42 PM: git clone https://github.com/mattbtay/faceoffspot
2:37:44 PM: Preparing Git Reference refs/heads/v2-sanity
2:37:45 PM: Parsing package.json dependencies
2:37:46 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI
2:37:46 PM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'functions' versus '' in the Netlify UI
2:37:46 PM: Starting build script
2:37:46 PM: Installing dependencies
2:37:46 PM: Python version set to 2.7
2:37:48 PM: v12.18.0 is already installed.
2:37:48 PM: Now using node v12.18.0 (npm v6.14.4)
2:37:48 PM: Started restoring cached build plugins
2:37:48 PM: Finished restoring cached build plugins
2:37:49 PM: Attempting ruby version 2.7.1, read from environment
2:37:50 PM: Required ruby-2.7.1 is not installed - installing.
2:37:51 PM: Searching for binary rubies, this might take some time.
2:37:51 PM: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/16.04/x86_64/ruby-2.7.1.tar.bz2
2:37:51 PM: Checking requirements for ubuntu.
2:37:52 PM: Requirements installation successful.
2:37:52 PM: ruby-2.7.1 - #configure
2:37:52 PM: ruby-2.7.1 - #download
2:37:53 PM: ruby-2.7.1 - #validate archive
2:38:01 PM: ruby-2.7.1 - #extract
2:38:04 PM: ruby-2.7.1 - #validate binary
2:38:06 PM: ruby-2.7.1 - #setup
2:38:06 PM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1@global
2:38:07 PM: ruby-2.7.1 - #importing gemset /opt/buildhome/.rvm/gemsets/global.gems........................................
2:38:07 PM: ruby-2.7.1 - #generating global wrappers........
2:38:07 PM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1
2:38:08 PM: ruby-2.7.1 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
2:38:08 PM: ruby-2.7.1 - #generating default wrappers........
2:38:09 PM: Using /opt/buildhome/.rvm/gems/ruby-2.7.1
2:38:09 PM: Using ruby version 2.7.1
2:38:10 PM: Using PHP version 5.6
2:38:10 PM: Started restoring cached node modules
2:38:10 PM: Finished restoring cached node modules
2:38:10 PM: Installing NPM modules using NPM version 6.14.4
2:38:50 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!
2:38:50 PM: > node-sass@5.0.0 install /opt/build/repo/node_modules/node-sass
2:38:50 PM: > node scripts/install.js
2:38:50 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v5.0.0/linux-x64-72_binding.node
2:38:51 PM: Download complete
2:38:51 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
2:38:51 PM: Caching binary to /opt/buildhome/.npm/node-sass/5.0.0/linux-x64-72_binding.node
2:38:51 PM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/@nuxt/babel-preset-app/node_modules/core-js
2:38:51 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:38:51 PM: > core-js@3.16.1 postinstall /opt/build/repo/node_modules/core-js
2:38:51 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:38:52 PM: > bootstrap-vue@2.21.2 postinstall /opt/build/repo/node_modules/bootstrap-vue
2:38:52 PM: > opencollective || exit 0
2:38:52 PM: > node-sass@5.0.0 postinstall /opt/build/repo/node_modules/node-sass
2:38:52 PM: > node scripts/build.js
2:38:52 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
2:38:52 PM: Testing binary
2:38:52 PM: Binary is fine
2:38:52 PM: > nuxt@2.15.8 postinstall /opt/build/repo/node_modules/nuxt
2:38:52 PM: > opencollective || exit 0
2:38:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
2:38: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"})
2:38:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
2:38: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"})
2:38:54 PM: added 1674 packages from 946 contributors and audited 1679 packages in 43.457s
2:38:56 PM: 181 packages are looking for funding
2:38:56 PM:   run `npm fund` for details
2:38:56 PM: found 4 vulnerabilities (2 moderate, 2 high)
2:38:56 PM:   run `npm audit fix` to fix them, or `npm audit` for details
2:38:56 PM: NPM modules installed
2:38:56 PM: Started restoring cached go cache
2:38:56 PM: Finished restoring cached go cache
2:38:57 PM: go version go1.14.4 linux/amd64
2:38:57 PM: go version go1.14.4 linux/amd64
2:38:57 PM: Installing missing commands
2:38:57 PM: Verify run directory
2:38:58 PM: ​
2:38:58 PM: ────────────────────────────────────────────────────────────────
2:38:58 PM:   Netlify Build                                                 
2:38:58 PM: ────────────────────────────────────────────────────────────────
2:38:58 PM: ​
2:38:58 PM: ❯ Version
2:38:58 PM:   @netlify/build 18.2.12
2:38:58 PM: ​
2:38:58 PM: ❯ Flags
2:38:58 PM:   baseRelDir: true
2:38:58 PM:   deployId: 611c1003c645a000d909eae9
2:38:58 PM: ​
2:38:58 PM: ❯ Current directory
2:38:58 PM:   /opt/build/repo
2:38:58 PM: ​
2:38:58 PM: ❯ Config file
2:38:58 PM:   /opt/build/repo/netlify.toml
2:38:58 PM: ​
2:38:58 PM: ❯ Context
2:38:58 PM:   production
2:38:58 PM: ​
2:38:58 PM: ❯ Installing plugins
2:38:58 PM:    - netlify-plugin-image-optim@0.4.0
2:38:58 PM:    - netlify-plugin-submit-sitemap@0.2.3
2:39:21 PM: ​
2:39:21 PM: ❯ Loading plugins
2:39:21 PM:    - netlify-plugin-image-optim@0.4.0 from Netlify app
2:39:21 PM:    - netlify-plugin-submit-sitemap@0.2.3 from netlify.toml
2:39:22 PM: ​
2:39:22 PM: ────────────────────────────────────────────────────────────────
2:39:22 PM:   1. Build command from Netlify app                             
2:39:22 PM: ────────────────────────────────────────────────────────────────
2:39:22 PM: ​
2:39:22 PM: $ npm run generate
2:39:22 PM: > faceoffspot@1.0.0 generate /opt/build/repo
2:39:22 PM: > nuxt generate
2:39:24 PM: [fatal] Cannot find module 'chalk'
2:39:24 PM: Require stack:
2:39:24 PM: - /opt/build/repo/node_modules/@nuxtjs/sanity/dist/module.js
2:39:24 PM:   Require stack:
2:39:24 PM:   - node_modules/@nuxtjs/sanity/dist/module.js
2:39:24 PM:   at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
2:39:24 PM:   at Function.resolve (internal/modules/cjs/helpers.js:78:19)
2:39:24 PM:   at p (node_modules/jiti/dist/jiti.js:1:52987)
2:39:24 PM:   at v (node_modules/jiti/dist/jiti.js:1:53886)
2:39:24 PM:   at node_modules/@nuxtjs/sanity/dist/module.js:5:15
2:39:24 PM:   at Resolver.v [as _require] (node_modules/jiti/dist/jiti.js:1:54801)
2:39:24 PM:   at Resolver.requireModule (node_modules/@nuxt/core/dist/core.js:381:29)
2:39:24 PM:   at ModuleContainer.addModule (node_modules/@nuxt/core/dist/core.js:182:38)
2:39:24 PM:   at node_modules/@nuxt/utils/dist/utils.js:639:43
2:39:24 PM:   at processTicksAndRejections (internal/process/task_queues.js:97:5)
2:39:24 PM: 
2:39:24 PM:    ╭──────────────────────────────────────────────────────────────────╮
2:39:24 PM:    │                                                                  │
2:39:24 PM:    │   ✖ Nuxt Fatal Error                                             │
2:39:24 PM:    │                                                                  │
2:39:24 PM:    │   Error: Cannot find module 'chalk'                              │
2:39:24 PM:    │   Require stack:                                                 │
2:39:24 PM:    │   - /opt/build/repo/node_modules/@nuxtjs/sanity/dist/module.js   │
2:39:24 PM:    │                                                                  │
2:39:24 PM:    ╰──────────────────────────────────────────────────────────────────╯
2:39:24 PM: 
2:39:24 PM: npm ERR! code ELIFECYCLE
2:39:24 PM: npm ERR! errno 1
2:39:24 PM: npm ERR! faceoffspot@1.0.0 generate: `nuxt generate`
2:39:24 PM: npm ERR! Exit status 1
2:39:24 PM: npm ERR!
2:39:24 PM: npm ERR! Failed at the faceoffspot@1.0.0 generate script.
2:39:24 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2:39:24 PM: npm ERR! A complete log of this run can be found in:
2:39:24 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-08-17T19_39_24_166Z-debug.log
2:39:24 PM: ​
2:39:24 PM: ────────────────────────────────────────────────────────────────
2:39:24 PM:   "build.command" failed                                        
2:39:24 PM: ────────────────────────────────────────────────────────────────
2:39:24 PM: ​
2:39:24 PM:   Error message
2:39:24 PM:   Command failed with exit code 1: npm run generate
2:39:24 PM: ​
2:39:24 PM:   Error location
2:39:24 PM:   In Build command from Netlify app:
2:39:24 PM:   npm run generate
2:39:24 PM: ​
2:39:24 PM:   Resolved config
2:39:24 PM:   build:
2:39:24 PM:     base: /opt/build/repo
2:39:24 PM:     command: npm run generate
2:39:24 PM:     commandOrigin: ui
2:39:24 PM:     environment:
2:39:24 PM:       - APIRUL
2:39:24 PM:       - client_secret
2:39:24 PM:     publish: /opt/build/repo/dist
2:39:24 PM:     publishOrigin: ui
2:39:24 PM:   functionsDirectory: /opt/build/repo/functions
2:39:24 PM:   plugins:
2:39:24 PM:     - inputs: {}
2:39:24 PM:       origin: ui
2:39:24 PM:       package: netlify-plugin-image-optim
2:39:24 PM:     - inputs: {}
2:39:24 PM:       origin: config
2:39:24 PM:       package: netlify-plugin-submit-sitemap
2:39:24 PM:   redirects:
2:39:24 PM:     - from: /api/*      status: 200      to: /.netlify/functions/:splat  redirectsOrigin: configCaching artifacts
2:39:24 PM: Started saving node modules
2:39:24 PM: Finished saving node modules
2:39:24 PM: Started saving build plugins
2:39:24 PM: Finished saving build plugins
2:39:24 PM: Started saving pip cache
2:39:24 PM: Finished saving pip cache
2:39:24 PM: Started saving emacs cask dependencies
2:39:24 PM: Finished saving emacs cask dependencies
2:39:24 PM: Started saving maven dependencies
2:39:24 PM: Finished saving maven dependencies
2:39:24 PM: Started saving boot dependencies
2:39:24 PM: Finished saving boot dependencies
2:39:24 PM: Started saving rust rustup cache
2:39:24 PM: Finished saving rust rustup cache
2:39:24 PM: Started saving go dependencies
2:39:24 PM: Finished saving go dependencies
2:39:28 PM: Cached ruby version 2.7.1
2:39:28 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:39:28 PM: Creating deploy upload records
2:39:28 PM: Failing build: Failed to build site
2:39:28 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
2:39:28 PM: Finished processing build request in 1m47.064092219s

Update: added chalk as a dependency and the project builds. I’m guessing the issue lies with @nuxtjs/sanity. I’ll consider this closed.