Vue.js Site Deployment Error - node package problem?

Hi, I’m new to web dev and I’ve been trying to create and deploy a starter portfolio page in vue.js. The project works perfectly in my native browser, but when I push my commits to github I keep getting the same deployment error in the netlify console. It is as follows:

7:47:26 PM: build-image version: d7b3813f01c06610bc1723ff1b22446513ee7941 (focal)
7:47:26 PM: build-image tag: v4.14.3
7:47:26 PM: buildbot version: 4dcf475b8df8e5368becf6538fc83d1d4914f8fc
7:47:26 PM: Fetching cached dependencies
7:47:26 PM: Starting to download cache of 80.6MB
7:47:27 PM: Finished downloading cache in 1.198018352s
7:47:27 PM: Starting to extract cache
7:47:28 PM: Finished extracting cache in 591.344271ms
7:47:28 PM: Finished fetching cache in 1.836307899s
7:47:28 PM: Starting to prepare the repo for build
7:47:28 PM: Preparing Git Reference refs/heads/maintenance
7:47:28 PM: Parsing package.json dependencies
7:47:30 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'portfolio/dist' versus 'dist' in the Netlify UI
7:47:30 PM: Starting build script
7:47:30 PM: Installing dependencies
7:47:30 PM: Python version set to 2.7
7:47:30 PM: Started restoring cached node version
7:47:31 PM: Finished restoring cached node version
7:47:31 PM: Downloading and installing node v16.18.1...
7:47:31 PM: Downloading https://nodejs.org/dist/v16.18.1/node-v16.18.1-linux-x64.tar.xz...
7:47:32 PM: Computing checksum with sha256sum
7:47:33 PM: Checksums matched!
7:47:34 PM: Now using node v16.18.1 (npm v8.19.2)
7:47:34 PM: Enabling node corepack
7:47:35 PM: Started restoring cached build plugins
7:47:35 PM: Finished restoring cached build plugins
7:47:35 PM: Attempting ruby version 2.7.2, read from environment
7:47:35 PM: Using ruby version 2.7.2
7:47:35 PM: Using PHP version 8.0
7:47:36 PM: No npm workspaces detected
7:47:36 PM: Started restoring cached node modules
7:47:36 PM: Finished restoring cached node modules
7:47:36 PM: Installing NPM modules using NPM version 8.19.2
7:47:37 PM: changed 18 packages, and audited 216 packages in 1s
7:47:37 PM: 37 packages are looking for funding
7:47:37 PM:   run `npm fund` for details
7:47:37 PM: found 0 vulnerabilities
7:47:37 PM: NPM modules installed
7:47:37 PM: Creating package sha
7:47:37 PM: Started restoring cached go cache
7:47:37 PM: Finished restoring cached go cache
7:47:38 PM: Installing Go version 1.17 (requested 1.17)
7:47:43 PM: unset GOOS;
7:47:43 PM: unset GOARCH;
7:47:43 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
7:47:43 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
7:47:43 PM: go version >&2;
7:47:43 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
7:47:43 PM: go version go1.17 linux/amd64
7:47:43 PM: Detected 1 framework(s)
7:47:43 PM: "vite" at version "3.2.2"
7:47:43 PM: Installing missing commands
7:47:43 PM: Verify run directory
7:47:44 PM: ​
7:47:44 PM: ────────────────────────────────────────────────────────────────
7:47:44 PM:   Netlify Build                                                 
7:47:44 PM: ────────────────────────────────────────────────────────────────
7:47:44 PM: ​
7:47:44 PM: ❯ Version
7:47:44 PM:   @netlify/build 28.1.7
7:47:44 PM: ​
7:47:44 PM: ❯ Flags
7:47:44 PM:   baseRelDir: true
7:47:44 PM:   buildId: 63656c4b3077fd0008fe59ee
7:47:44 PM:   deployId: 63656c4b3077fd0008fe59f0
7:47:44 PM: ​
7:47:44 PM: ❯ Current directory
7:47:44 PM:   /opt/build/repo/portfolio
7:47:44 PM: ​
7:47:44 PM: ❯ Config file
7:47:44 PM:   /opt/build/repo/portfolio/netlify.toml
7:47:44 PM: ​
7:47:44 PM: ❯ Context
7:47:44 PM:   production
7:47:44 PM: ​
7:47:44 PM: ────────────────────────────────────────────────────────────────
7:47:44 PM:   1. Build command from Netlify app                             
7:47:44 PM: ────────────────────────────────────────────────────────────────
7:47:44 PM: ​
7:47:44 PM: $ npm run build
7:47:45 PM: > portfolio@0.0.0 build
7:47:45 PM: > vite build
7:47:45 PM: vite v3.2.2 building for production...
7:47:45 PM: transforming...
7:47:45 PM: ✓ 6 modules transformed.
7:47:45 PM: Could not resolve './views/Maintenance.vue' from src/main.js
7:47:45 PM: error during build:
7:47:45 PM: Error: Could not resolve './views/Maintenance.vue' from src/main.js
7:47:45 PM:     at error (file:///opt/build/repo/portfolio/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
7:47:45 PM:     at ModuleLoader.handleResolveId (file:///opt/build/repo/portfolio/node_modules/rollup/dist/es/shared/rollup.js:22156:24)
7:47:45 PM:     at file:///opt/build/repo/portfolio/node_modules/rollup/dist/es/shared/rollup.js:22119:26
7:47:45 PM: ​
7:47:45 PM: ────────────────────────────────────────────────────────────────
7:47:45 PM:   "build.command" failed                                        
7:47:45 PM: ────────────────────────────────────────────────────────────────
7:47:45 PM: ​
7:47:45 PM:   Error message
7:47:45 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
7:47:45 PM: ​
7:47:45 PM:   Error location
7:47:45 PM:   In Build command from Netlify app:
7:47:45 PM:   npm run build
7:47:45 PM: ​
7:47:45 PM:   Resolved config
7:47:45 PM:   build:
7:47:45 PM:     base: /opt/build/repo/portfolio
7:47:45 PM:     command: npm run build
7:47:45 PM:     commandOrigin: ui
7:47:47 PM: Creating deploy upload records
7:47:45 PM:     publish: /opt/build/repo/portfolio/dist
7:47:45 PM:     publishOrigin: ui
7:47:45 PM:   redirects:
7:47:45 PM:     - from: /*      status: 200      to: /index.html  redirectsOrigin: configCaching artifacts
7:47:45 PM: Started saving node modules
7:47:47 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
7:47:45 PM: Finished saving node modules
7:47:45 PM: Started saving build plugins
7:47:45 PM: Finished saving build plugins
7:47:45 PM: Started saving pip cache
7:47:45 PM: Finished saving pip cache
7:47:45 PM: Started saving emacs cask dependencies
7:47:45 PM: Finished saving emacs cask dependencies
7:47:45 PM: Started saving maven dependencies
7:47:46 PM: Finished saving maven dependencies
7:47:46 PM: Started saving boot dependencies
7:47:46 PM: Finished saving boot dependencies
7:47:46 PM: Started saving rust rustup cache
7:47:46 PM: Finished saving rust rustup cache
7:47:46 PM: Started saving go dependencies
7:47:46 PM: Finished saving go dependencies
7:47:46 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:47:47 PM: Failing build: Failed to build site
7:47:47 PM: Finished processing build request in 20.843714057s

I am sure that I have imported all files correctly, so I am wondering what this error might relate to and why it may have come about. I’d appreciate any help at all :slight_smile:

Thanks in advance!

Hi @dvshkbm, thanks for the post and welcome.

The problem is caused by the highlighted lines above from your log.

Kindly check your code and make sure that the Maintenance.vue component you are importing in the main.js file has the correct spelling or correct file path.

Let me know the outcome.

Thanks.

Also, do check this: