Netlify Build Error: Can't resolve 'babel-runtime/helpers/classCallCheck'

My netlify site name. ‘ charming-moon-0f534’ link > Netlify App
I have set-up local DEV environment, which successfully builds and the commits are making into the ‘Preview’ branch.

Problem occurs when Netlify attempts to deploy the site to ‘Master’ Build. Please see the FULL build log & build settings screenshot below. I have bolded the sections which I believe indicate the errors.

I got a similar error upon initial set-up of my local development environment after running ‘npm audit fix’. Not sure if that’s related.

I appreciate any help or suggestions you can provide.
Thank you in advance.

10:00:07 PM: Build ready to start
10:00:10 PM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
10:00:10 PM: build-image tag: v3.6.1
10:00:10 PM: buildbot version: df42d44cc6a0381cf657a671baf049c03981bafe
10:00:10 PM: Fetching cached dependencies
10:00:10 PM: Starting to download cache of 145.1MB
10:00:11 PM: Finished downloading cache in 1.174436943s
10:00:11 PM: Starting to extract cache
10:00:18 PM: Finished extracting cache in 7.265189369s
10:00:18 PM: Finished fetching cache in 8.52610486s
10:00:18 PM: Starting to prepare the repo for build
10:00:19 PM: Preparing Git Reference refs/heads/master
10:00:24 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘public’ versus ‘/’ in the Netlify UI
10:00:24 PM: Different build command detected, going to use the one specified in the Netlify configuration file: ‘npm run build’ versus ‘’ in the Netlify UI
10:00:25 PM: Starting build script
10:00:25 PM: Installing dependencies
10:00:25 PM: Python version set to 2.7
10:00:25 PM: Started restoring cached node version
10:00:28 PM: Finished restoring cached node version
10:00:29 PM: v12.18.0 is already installed.
10:00:30 PM: Now using node v12.18.0 (npm v6.14.4)
10:00:30 PM: Started restoring cached build plugins
10:00:30 PM: Finished restoring cached build plugins
10:00:30 PM: Attempting ruby version 2.7.1, read from environment
10:00:32 PM: Using ruby version 2.7.1
10:00:32 PM: Using PHP version 5.6
10:00:32 PM: Started restoring cached node modules
10:00:32 PM: Finished restoring cached node modules
10:00:32 PM: Installing NPM modules using NPM version 6.14.4
10:01:13 PM: > core-js@3.9.0 postinstall /opt/build/repo/node_modules/core-js
10:01:13 PM: > node -e "try{require(’./postinstall’)}catch(e){}"
10:01:13 PM: > core-js-pure@3.9.0 postinstall /opt/build/repo/node_modules/core-js-pure
10:01:13 PM: > node -e "try{require(’./postinstall’)}catch(e){}"
10:01:14 PM: > gatsby-telemetry@1.10.0 postinstall /opt/build/repo/node_modules/gatsby-telemetry
10:01:14 PM: > node src/postinstall.js || true
10:01:14 PM: > gatsby-cli@2.19.1 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
10:01:14 PM: > node scripts/postinstall.js
10:01:14 PM: > gatsby@2.32.4 postinstall /opt/build/repo/node_modules/gatsby
10:01:14 PM: > node scripts/postinstall.js
10:01:17 PM: npm WARN stackbit-libris-theme@0.0.1 No repository field.
10:01:17 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
10:01:17 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:01:17 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/watchpack/node_modules/fsevents):
10:01:17 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:01:17 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
10:01:17 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:01:17 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/gatsby/node_modules/fsevents):
10:01:17 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:01:17 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/gatsby-recipes/node_modules/fsevents):
10:01:17 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:01:17 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/gatsby-plugin-page-creator/node_modules/fsevents):
10:01:17 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:01:17 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/gatsby-page-utils/node_modules/fsevents):
10:01:17 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:01:17 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
10:01:17 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:01:17 PM: added 303 packages from 191 contributors, removed 496 packages, updated 393 packages and audited 2184 packages in 43.48s
10:01:19 PM: 172 packages are looking for funding
10:01:19 PM: run npm fund for details
10:01:19 PM: found 2 vulnerabilities (1 low, 1 moderate)
10:01:19 PM: run npm audit fix to fix them, or npm audit for details
10:01:19 PM: NPM modules installed
10:01:20 PM: Started restoring cached go cache
10:01:20 PM: Finished restoring cached go cache
10:01:20 PM: go version go1.14.4 linux/amd64
10:01:20 PM: go version go1.14.4 linux/amd64
10:01:20 PM: Installing missing commands
10:01:20 PM: Verify run directory
10:01:22 PM: ​
10:01:22 PM: ────────────────────────────────────────────────────────────────
10:01:22 PM: Netlify Build
10:01:22 PM: ────────────────────────────────────────────────────────────────
10:01:22 PM: ​
10:01:22 PM: ❯ Version
10:01:22 PM: @netlify/build 9.1.3
10:01:22 PM: ​
10:01:22 PM: ❯ Flags
10:01:22 PM: deployId: 603499e735e60b98ae740d91
10:01:22 PM: mode: buildbot
10:01:22 PM: ​
10:01:22 PM: ❯ Current directory
10:01:22 PM: /opt/build/repo
10:01:22 PM: ​
10:01:22 PM: ❯ Config file
10:01:22 PM: /opt/build/repo/netlify.toml
10:01:22 PM: ​
10:01:22 PM: ❯ Context
10:01:22 PM: production
10:01:22 PM: ​
10:01:22 PM: ────────────────────────────────────────────────────────────────
10:01:22 PM: 1. build.command from netlify.toml
10:01:22 PM: ────────────────────────────────────────────────────────────────
10:01:22 PM: ​
10:01:22 PM: $ npm run build
10:01:22 PM: > stackbit-libris-theme@0.0.1 build /opt/build/repo
10:01:22 PM: > gatsby build --prefix-paths
10:01:26 PM: success open and validate gatsby-configs - 0.059s
10:01:27 PM: success load plugins - 0.634s
10:01:27 PM: success onPreInit - 0.138s
10:01:27 PM: success delete html and css files from previous builds - 0.003s
10:01:27 PM: success initialize cache - 0.006s
10:01:27 PM: success copy gatsby files - 0.059s
10:01:27 PM: success onPreBootstrap - 0.021s
10:01:27 PM: success createSchemaCustomization - 0.006s
10:01:27 PM: info [gatsby-source-data] setup file watcher and create site data
10:01:27 PM: info [gatsby-source-data] create site data from files, updated path: null
10:01:28 PM: success Checking for changed pages - 0.000s
10:01:28 PM: success source and transform nodes - 0.647s
10:01:28 PM: success building schema - 0.523s
10:01:31 PM: info Total nodes: 398, SitePage nodes: 110 (use --verbose for breakdown)
10:01:31 PM: success createPages - 2.315s
10:01:31 PM: success Checking for changed pages - 0.000s
10:01:31 PM: success createPagesStatefully - 0.089s
10:01:31 PM: success update schema - 0.349s
10:01:31 PM: success onPreExtractQueries - 0.004s
10:01:31 PM: success extract queries from components - 0.237s
10:01:31 PM: success write out redirect data - 0.001s
10:01:31 PM: success onPostBootstrap - 0.000s
10:01:31 PM: info bootstrap finished - 8.961s
10:01:32 PM: success run page queries - 1.039s - 109/109 104.93/s
10:01:32 PM: success write out requires - 0.006s
10:02:10 PM: failed Building production JavaScript and CSS bundles - 37.603s
10:02:10 PM: error Generating JavaScript bundles failed
10:02:10 PM: Can’t resolve ‘babel-runtime/helpers/classCallCheck’ in '/opt/build/repo/node_modules/react-script-tag/lib’
10:02:10 PM: If you’re trying to use a package make sure that ‘babel-runtime/helpers/classCallCheck’ is installed. If you’re trying to use a local file make sure that the path is correct.
10:02:10 PM: error Generating JavaScript bundles failed
10:02:10 PM: Can’t resolve ‘babel-runtime/helpers/extends’ in ‘/opt/build/repo/node_modules/react-script-tag/lib’
10:02:10 PM: If you’re trying to use a package make sure that ‘babel-runtime/helpers/extends’ is installed. If you’re trying to use a local file make sure that the path is correct.
10:02:10 PM: error Generating JavaScript bundles failed
10:02:10 PM: Can’t resolve ‘babel-runtime/helpers/inherits’ in ‘/opt/build/repo/node_modules/react-script-tag/lib’
10:02:10 PM: If you’re trying to use a package make sure that ‘babel-runtime/helpers/inherits’ is installed. If you’re trying to use a local file make sure that the path is correct.
10:02:10 PM: error Generating JavaScript bundles failed
10:02:10 PM: Can’t resolve ‘babel-runtime/helpers/objectWithoutProperties’ in ‘/opt/build/repo/node_modules/react-script-tag/lib’
10:02:10 PM: If you’re trying to use a package make sure that ‘babel-runtime/helpers/objectWithoutProperties’ is installed. If you’re trying to use a local file make sure that the path is correct.
10:02:10 PM: error Generating JavaScript bundles failed
10:02:10 PM: Can’t resolve ‘babel-runtime/helpers/possibleConstructorReturn’ in ‘/opt/build/repo/node_modules/react-script-tag/lib’
10:02:10 PM: If you’re trying to use a package make sure that ‘babel-runtime/helpers/possibleConstructorReturn’ is installed. If you’re trying to use a local file make sure that the path is correct.
10:02:10 PM: npm ERR! code ELIFECYCLE
10:02:10 PM: npm ERR! errno 1
10:02:10 PM: npm ERR! stackbit-libris-theme@0.0.1 build: gatsby build --prefix-paths
10:02:10 PM: npm ERR! Exit status 1
10:02:10 PM: npm ERR!
10:02:10 PM: npm ERR! Failed at the stackbit-libris-theme@0.0.1 build script.
10:02:10 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:02:10 PM: npm ERR! A complete log of this run can be found in:
10:02:10 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-02-23T06_02_10_879Z-debug.log
10:02:10 PM: ​
10:02:10 PM: ────────────────────────────────────────────────────────────────
10:02:10 PM: “build.command” failed
10:02:10 PM: ────────────────────────────────────────────────────────────────
10:02:10 PM: ​
10:02:10 PM: Error message
10:02:10 PM: Command failed with exit code 1: npm run build
10:02:10 PM: ​
10:02:10 PM: Error location
10:02:10 PM: In build.command from netlify.toml:
10:02:10 PM: npm run build
10:02:10 PM: ​
10:02:10 PM: Resolved config
10:02:10 PM: build:
10:02:10 PM: command: npm run build
10:02:10 PM: commandOrigin: config
10:02:10 PM: environment:
10:02:10 PM: - INCOMING_HOOK_BODY
10:02:10 PM: - INCOMING_HOOK_TITLE
10:02:10 PM: - INCOMING_HOOK_URL
10:02:10 PM: publish: /opt/build/repo/public
10:02:11 PM: Caching artifacts
10:02:11 PM: Started saving node modules
10:02:11 PM: Finished saving node modules
10:02:11 PM: Started saving build plugins
10:02:11 PM: Finished saving build plugins
10:02:11 PM: Started saving pip cache
10:02:11 PM: Finished saving pip cache
10:02:11 PM: Started saving emacs cask dependencies
10:02:11 PM: Finished saving emacs cask dependencies
10:02:11 PM: Started saving maven dependencies
10:02:11 PM: Finished saving maven dependencies
10:02:11 PM: Started saving boot dependencies
10:02:11 PM: Finished saving boot dependencies
10:02:11 PM: Started saving rust rustup cache
10:02:11 PM: Finished saving rust rustup cache
10:02:11 PM: Started saving go dependencies
10:02:11 PM: Finished saving go dependencies
10:02:11 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:02:11 PM: Failing build: Failed to build site
10:02:11 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
10:02:11 PM: Finished processing build request in 2m1.263805507s

Would it be possible for you to share your repo? Or as reported here: Module not found: Error: Can't resolve '@babel/runtime/helpers/createSuper' · Issue #11318 · babel/babel · GitHub, try updating your dependency.

Thanks for your response!
The repo is here GitHub - donnay/charming-moon: Jamstack site created with Stackbit

The local environment builds w/o issue. The challenge I have is understanding how to get netlify’s build command to use the updated dependencies.

Sorry for the n00b question.
Thanks for your help @hrishikesh

Generally speaking, once your package.json is updated, the dependencies on Netlify update too. I’ll try the repo locally and try to figure out what’s happening.

I got the same error locally, so seems like it’s not specific to Netlify.

Adding "babel-runtime": "6.26.0", to your package.json fixes the issue. Here’s the complete package.json:

{
  "name": "stackbit-libris-theme",
  "description": "Stackbit Libris Theme",
  "version": "0.0.1",
  "license": "MIT",
  "scripts": {
    "develop": "gatsby develop",
    "build": "gatsby build --prefix-paths",
    "serve": "gatsby serve",
    "clean": "gatsby clean"
  },
  "dependencies": {
    "@stackbit/gatsby-plugin-menus": "0.0.4",
    "babel-runtime": "6.26.0",
    "chokidar": "3.4.0",
    "classnames": "2.2.6",
    "fs-extra": "9.1.0",
    "gatsby": "^2.30.0",
    "gatsby-plugin-react-helmet": "3.3.3",
    "gatsby-plugin-sass": "3.2.0",
    "gatsby-source-filesystem": "2.11.0",
    "gatsby-transformer-remark": "2.16.0",
    "js-yaml": "4.0.0",
    "lodash": "4.17.21",
    "marked": "2.0.0",
    "moment": "2.23.0",
    "moment-strftime": "0.5.0",
    "node-sass": "5.0.0",
    "node-sass-utils": "1.1.2",
    "react": "17.0.1",
    "react-dom": "16.5.1",
    "react-helmet": "6.1.0",
    "react-html-parser": "2.0.2",
    "react-script-tag": "1.1.2",
    "rehype-react": "6.2.0",
    "sprintf-js": "1.1.2"
  }
}

Note, I’ve updated all dependencies to their latest versions so, you might have to run the command as npm install --legacy-peer-deps. Not sure if it works with Netlify, so if it doesn’t, you can stick with the older versions.

1 Like

Thank you ! This resolved the build issue I was having, and netlify seems to work with the updates!