Could not resolve "./context/WishlistContext" from "src/App.jsx"

2:00:06 PM: build-image version: 596993885fcc8df0dd6d507c57c5c9cb7c3a8576 (focal)
2:00:06 PM: buildbot version: 163fe70070e26a02d64141bf435d02320d25b8c1
2:00:06 PM: Fetching cached dependencies
2:00:06 PM: Failed to fetch cache, continuing with build
2:00:06 PM: Starting to prepare the repo for build
2:00:06 PM: No cached dependencies found. Cloning fresh repo
2:00:06 PM: git clone --filter=blob:none GitHub - mhmd-k/shopping-cart: A shopping cart website built with React, React Router, and Bootstrap.
2:00:07 PM: Preparing Git Reference refs/heads/main
2:00:07 PM: Parsing package.json dependencies
2:00:09 PM: Starting to install dependencies
2:00:09 PM: Python version set to 3.8
2:00:09 PM: Attempting Ruby version 2.7.2, read from environment
2:00:09 PM: Using Ruby version 2.7.2
2:00:10 PM: Started restoring cached go cache
2:00:10 PM: Finished restoring cached go cache
2:00:10 PM: Installing Go version 1.19.5 (requested 1.19.5)
2:00:14 PM: go version go1.19.5 linux/amd64
2:00:15 PM: Using PHP version 8.0
2:00:16 PM: v16.20.0 is already installed.
2:00:16 PM: Now using node v16.20.0 (npm v8.19.4)
2:00:16 PM: Enabling Node.js Corepack
2:00:16 PM: Started restoring cached build plugins
2:00:16 PM: Finished restoring cached build plugins
2:00:16 PM: Started restoring cached corepack dependencies
2:00:16 PM: Finished restoring cached corepack dependencies
2:00:16 PM: No npm workspaces detected
2:00:16 PM: Started restoring cached node modules
2:00:16 PM: Finished restoring cached node modules
2:00:16 PM: Installing npm packages using npm version 8.19.4
2:00:18 PM: added 111 packages, and audited 112 packages in 2s
2:00:18 PM: 11 packages are looking for funding
2:00:18 PM: run npm fund for details
2:00:18 PM: found 0 vulnerabilities
2:00:18 PM: npm packages installed
2:00:19 PM: Install dependencies script success
2:00:19 PM: Starting build script
2:00:19 PM: Detected 1 framework(s)
2:00:20 PM: “vite” at version “4.2.1”
2:00:20 PM: Section completed: initializing
2:00:21 PM: ​
2:00:21 PM: Netlify Build
2:00:21 PM: ────────────────────────────────────────────────────────────────
2:00:21 PM: ​
2:00:21 PM: ❯ Version
2:00:21 PM: @netlify/build 29.9.0
2:00:21 PM: ​
2:00:21 PM: ❯ Flags
2:00:21 PM: baseRelDir: true
2:00:21 PM: buildId: 64353db19f67c938714c0ab1
2:00:21 PM: deployId: 64353db19f67c938714c0ab3
2:00:21 PM: ​
2:00:21 PM: ❯ Current directory
2:00:21 PM: /opt/build/repo
2:00:21 PM: ​
2:00:21 PM: ❯ Config file
2:00:21 PM: No config file was defined: using default values.
2:00:21 PM: ​
2:00:21 PM: ❯ Context
2:00:21 PM: production
2:00:21 PM: ​
2:00:21 PM: 1. Build command from Netlify app
2:00:21 PM: ────────────────────────────────────────────────────────────────
2:00:21 PM: ​
2:00:21 PM: $ npm run build
2:00:21 PM: > shopping-cart@0.0.0 build
2:00:21 PM: > vite build
2:00:22 PM: vite v4.2.1 building for production…
2:00:22 PM: transforming…
2:00:22 PM: ✓ 18 modules transformed.
2:00:22 PM: ✓ built in 193ms
2:00:22 PM: Could not resolve “./context/WishlistContext” from “src/App.jsx”
2:00:22 PM: file: /opt/build/repo/src/App.jsx
2:00:22 PM: error during build:
2:00:22 PM: RollupError: Could not resolve “./context/WishlistContext” from “src/App.jsx”
2:00:22 PM: at error (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:2128:30)
2:00:22 PM: at ModuleLoader.handleInvalidResolvedId (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:23782:24)
2:00:22 PM: at file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:23744:26
2:00:22 PM: ​
2:00:22 PM: “build.command” failed
2:00:22 PM: ────────────────────────────────────────────────────────────────
2:00:22 PM: ​
2:00:22 PM: Error message
2:00:22 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
2:00:22 PM: ​
2:00:22 PM: Error location
2:00:22 PM: In Build command from Netlify app:
2:00:23 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
2:00:22 PM: npm run build
2:00:22 PM: ​
2:00:22 PM: Resolved config
2:00:22 PM: build:
2:00:22 PM: command: npm run build
2:00:22 PM: commandOrigin: ui
2:00:22 PM: publish: /opt/build/repo/dist
2:00:22 PM: publishOrigin: ui
2:00:22 PM: Caching artifacts
2:00:22 PM: Started saving node modules
2:00:22 PM: Finished saving node modules
2:00:22 PM: Started saving build plugins
2:00:22 PM: Finished saving build plugins
2:00:22 PM: Started saving corepack cache
2:00:22 PM: Finished saving corepack cache
2:00:23 PM: Started saving pip cache
2:00:23 PM: Finished saving pip cache
2:00:23 PM: Started saving emacs cask dependencies
2:00:23 PM: Finished saving emacs cask dependencies
2:00:23 PM: Started saving maven dependencies
2:00:23 PM: Finished saving maven dependencies
2:00:23 PM: Started saving boot dependencies
2:00:23 PM: Finished saving boot dependencies
2:00:23 PM: Started saving rust rustup cache
2:00:23 PM: Finished saving rust rustup cache
2:00:23 PM: Started saving go dependencies
2:00:23 PM: Finished saving go dependencies
2:00:23 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:00:23 PM: Failing build: Failed to build site
2:00:23 PM: Finished processing build request in 17.515s

Hi there, glad you found us; before we can help you, we need a little more information on the issues you are facing.

First, have you looked through this resource? It is a compilation of all of our build and deploy resources. This is a good starting point.

If you have worked through those guides and are still encountering issues please share the following information:

  • the name of your build instance: “example-jones.netlify.com
  • what you have already tried
  • any error messages you have received in your terminal window or in the developer console

I would specifically point you to the [Support Guide] Netlify app builds locally but fails on deploy (case sensitivity) support guide in the link Sam has provided.

1 Like