ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")

I am trying to deploy my app for the first time on netlify. I have it up and running locally, and it is doing what it should be, but I got the following error message when I tried to deploy from my github repository. Here’s the complete build log:

11:35:22 AM: build-image version: 9495be345de05eb8e91837e5d92c5afd0dbd65f6 (focal)
11:35:22 AM: buildbot version: 9495be345de05eb8e91837e5d92c5afd0dbd65f6
11:35:22 AM: Fetching cached dependencies
11:35:22 AM: Failed to fetch cache, continuing with build
11:35:22 AM: Starting to prepare the repo for build
11:35:23 AM: No cached dependencies found. Cloning fresh repo
11:35:23 AM: git clone --filter=blob:none https://github.com/jformio/tink-to-miro
11:35:23 AM: Preparing Git Reference refs/heads/main
11:35:24 AM: Parsing package.json dependencies
11:35:26 AM: Starting build script
11:35:26 AM: Installing dependencies
11:35:26 AM: Python version set to 2.7
11:35:26 AM: v16.19.0 is already installed.
11:35:27 AM: Now using node v16.19.0 (npm v8.19.3)
11:35:27 AM: Enabling Node.js Corepack
11:35:27 AM: Started restoring cached build plugins
11:35:27 AM: Finished restoring cached build plugins
11:35:27 AM: Attempting Ruby version 2.7.2, read from environment
11:35:28 AM: Using Ruby version 2.7.2
11:35:28 AM: Using PHP version 8.0
11:35:28 AM: Started restoring cached corepack dependencies
11:35:28 AM: Finished restoring cached corepack dependencies
11:35:28 AM: No npm workspaces detected
11:35:28 AM: Started restoring cached node modules
11:35:28 AM: Finished restoring cached node modules
11:35:28 AM: Bypassing sha validation. Running pre & post install scripts
11:35:28 AM: Installing npm packages using npm version 8.19.3
11:35:31 AM: npm WARN deprecated @vitejs/plugin-react-refresh@1.3.6: This package has been deprecated in favor of @vitejs/plugin-react
11:35:35 AM: added 345 packages, and audited 346 packages in 7s
11:35:35 AM: 48 packages are looking for funding
11:35:35 AM:   run `npm fund` for details
11:35:35 AM: found 0 vulnerabilities
11:35:35 AM: npm packages installed
11:35:36 AM: Started restoring cached go cache
11:35:36 AM: Finished restoring cached go cache
11:35:36 AM: go version go1.19.5 linux/amd64
11:35:36 AM: Detected 1 framework(s)
11:35:36 AM: "vite" at version "2.9.13"
11:35:36 AM: Installing missing commands
11:35:36 AM: Verify run directory
11:35:36 AM: Section completed: initializing
11:35:38 AM: ​
11:35:38 AM:   Netlify Build                                                 
11:35:38 AM: ────────────────────────────────────────────────────────────────
11:35:38 AM: ​
11:35:38 AM: ❯ Version
11:35:38 AM:   @netlify/build 29.5.4
11:35:38 AM: ​
11:35:38 AM: ❯ Flags
11:35:38 AM:   baseRelDir: true
11:35:38 AM:   buildId: 63e37ae1ce440616eb7a24e9
11:35:38 AM:   deployId: 63e37ae1ce440616eb7a24eb
11:35:38 AM: ​
11:35:38 AM: ❯ Current directory
11:35:38 AM:   /opt/build/repo
11:35:38 AM: ​
11:35:38 AM: ❯ Config file
11:35:38 AM:   /opt/build/repo/netlify.toml
11:35:38 AM: ​
11:35:38 AM: ❯ Context
11:35:38 AM:   production
11:35:38 AM: ​
11:35:38 AM:   1. Build command from Netlify app                             
11:35:38 AM: ────────────────────────────────────────────────────────────────
11:35:38 AM: ​
11:35:38 AM: $ npm run build
11:35:38 AM: > github-appcards@1.0.0 build
11:35:38 AM: > vite build
11:35:38 AM: vite v2.9.13 building for production...
11:35:38 AM: transforming...
11:35:39 AM: ✓ 354 modules transformed.
11:35:39 AM: rendering chunks...
11:35:39 AM: [vite:esbuild-transpile] Transform failed with 1 error:
11:35:39 AM: assets/app.d4ab08c3.js:566:21: ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
11:35:39 AM: 
11:35:39 AM: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
11:35:39 AM: 564|  };
11:35:39 AM: 565|
11:35:39 AM: 566|  let assetSelection = await miro.board.getSelection();
11:35:39 AM:    |                       ^
11:35:39 AM: 567|  console.log(assetSelection);
11:35:39 AM: 568|  let shapes = assetSelection.filter((item) => item.type === "shape");
11:35:39 AM: 
11:35:39 AM: error during build:
11:35:39 AM: Error: Transform failed with 1 error:
11:35:39 AM: assets/app.d4ab08c3.js:566:21: ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
11:35:39 AM:     at failureErrorWithLog (/opt/build/repo/node_modules/esbuild/lib/main.js:1624:15)
11:35:39 AM:     at /opt/build/repo/node_modules/esbuild/lib/main.js:1413:29
11:35:39 AM:     at /opt/build/repo/node_modules/esbuild/lib/main.js:678:9
11:35:39 AM:     at handleIncomingPacket (/opt/build/repo/node_modules/esbuild/lib/main.js:775:9)
11:35:39 AM:     at Socket.readFromStdout (/opt/build/repo/node_modules/esbuild/lib/main.js:644:7)
11:35:39 AM:     at Socket.emit (node:events:513:28)
11:35:39 AM:     at addChunk (node:internal/streams/readable:315:12)
11:35:39 AM:     at readableAddChunk (node:internal/streams/readable:289:9)
11:35:39 AM:     at Socket.Readable.push (node:internal/streams/readable:228:10)
11:35:39 AM:     at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
11:35:39 AM: ​
11:35:39 AM:   "build.command" failed                                        
11:35:39 AM: ────────────────────────────────────────────────────────────────
11:35:39 AM: ​
11:35:39 AM:   Error message
11:35:41 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
11:35:39 AM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
11:35:39 AM: ​
11:35:39 AM:   Error location
11:35:39 AM:   In Build command from Netlify app:
11:35:39 AM:   npm run build
11:35:39 AM: ​
11:35:39 AM:   Resolved config
11:35:39 AM:   build:
11:35:39 AM:     command: npm run build
11:35:39 AM:     commandOrigin: ui
11:35:39 AM:     publish: /opt/build/repo/dist
11:35:39 AM:     publishOrigin: ui
11:35:39 AM:   functions:
11:35:39 AM:     '*':
11:35:39 AM:       included_files:
11:35:40 AM:         - src/utils/*.ts
      node_bundler: esbuild
  functionsDirectory: /opt/build/repo/netlify/functions
Caching artifacts
11:35:40 AM: Started saving node modules
11:35:40 AM: Finished saving node modules
11:35:40 AM: Started saving build plugins
11:35:40 AM: Finished saving build plugins
11:35:40 AM: Started saving corepack cache
11:35:40 AM: Finished saving corepack cache
11:35:40 AM: Started saving pip cache
11:35:40 AM: Finished saving pip cache
11:35:40 AM: Started saving emacs cask dependencies
11:35:40 AM: Finished saving emacs cask dependencies
11:35:40 AM: Started saving maven dependencies
11:35:40 AM: Finished saving maven dependencies
11:35:40 AM: Started saving boot dependencies
11:35:40 AM: Finished saving boot dependencies
11:35:40 AM: Started saving rust rustup cache
11:35:40 AM: Finished saving rust rustup cache
11:35:40 AM: Started saving go dependencies
11:35:40 AM: Finished saving go dependencies
11:35:40 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:35:40 AM: Failing build: Failed to build site
11:35:41 AM: Finished processing build request in 18.459s

Hi @jformio :wave:t6: ,

Welcome to the forums and thank you for reaching out!

  • Did you set your build command? build command as CI= npm run build
  • Please check out this resource
  • If none of the above helps please share your slug/site name