Deploy failed using parcel build

Greetings,

I have a problem with deploying a website.
As a build command I am using: parcel build index.html
Publish directory: dist

The error:

10:44:46 AM: Build ready to start
10:44:47 AM: build-image version: 9289b698a503f132b265bd089ab40ce1d6f9e65e (focal)
10:44:47 AM: build-image tag: v4.12.0
10:44:47 AM: buildbot version: 8004afba0d79c2913deefb1ea0ee8f3ed710b828
10:44:47 AM: Fetching cached dependencies
10:44:47 AM: Starting to download cache of 6.3MB
10:44:47 AM: Finished downloading cache in 130.199024ms
10:44:47 AM: Starting to extract cache
10:44:47 AM: Finished extracting cache in 11.915016ms
10:44:47 AM: Finished fetching cache in 199.855766ms
10:44:47 AM: Starting to prepare the repo for build
10:44:47 AM: Preparing Git Reference refs/heads/main
10:44:48 AM: Parsing package.json dependencies
10:44:48 AM: Starting build script
10:44:48 AM: Installing dependencies
10:44:48 AM: Python version set to 2.7
10:44:49 AM: v16.17.1 is already installed.
10:44:49 AM: Now using node v16.17.1 (npm v8.15.0)
10:44:49 AM: Started restoring cached build plugins
10:44:49 AM: Finished restoring cached build plugins
10:44:49 AM: Attempting ruby version 2.7.2, read from environment
10:44:50 AM: Using ruby version 2.7.2
10:44:50 AM: Using PHP version 8.0
10:44:50 AM: Started restoring cached go cache
10:44:50 AM: Finished restoring cached go cache
10:44:50 AM: Installing Go version 1.17 (requested 1.17)
10:44:54 AM: unset GOOS;
10:44:54 AM: unset GOARCH;
10:44:54 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
10:44:54 AM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
10:44:54 AM: go version >&2;
10:44:54 AM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
10:44:54 AM: go version go1.17 linux/amd64
10:44:54 AM: Installing missing commands
10:44:54 AM: Verify run directory
10:44:55 AM: ​
10:44:55 AM: ────────────────────────────────────────────────────────────────
10:44:55 AM:   Netlify Build                                                 
10:44:55 AM: ────────────────────────────────────────────────────────────────
10:44:55 AM: ​
10:44:55 AM: ❯ Version
10:44:55 AM:   @netlify/build 27.20.1
10:44:55 AM: ​
10:44:55 AM: ❯ Flags
10:44:55 AM:   baseRelDir: true
10:44:55 AM:   buildId: 633d43fdd3d0205d3c70f79c
10:44:55 AM:   deployId: 633d43fdd3d0205d3c70f79e
10:44:55 AM: ​
10:44:55 AM: ❯ Current directory
10:44:55 AM:   /opt/build/repo
10:44:55 AM: ​
10:44:55 AM: ❯ Config file
10:44:55 AM:   No config file was defined: using default values.
10:44:55 AM: ​
10:44:55 AM: ❯ Context
10:44:55 AM:   production
10:44:55 AM: ​
10:44:55 AM: ────────────────────────────────────────────────────────────────
10:44:55 AM:   1. Build command from Netlify app                             
10:44:55 AM: ────────────────────────────────────────────────────────────────
10:44:55 AM: ​
10:44:55 AM: $ parcel build index.html
10:44:55 AM: bash: parcel: command not found
10:44:55 AM: ​
10:44:55 AM: ────────────────────────────────────────────────────────────────
10:44:55 AM:   "build.command" failed                                        
10:44:55 AM: ────────────────────────────────────────────────────────────────
10:44:55 AM: ​
10:44:55 AM:   Error message
10:44:55 AM:   Command failed with exit code 127: parcel build index.html (https://ntl.fyi/exit-code-127)
10:44:55 AM: ​
10:44:55 AM:   Error location
10:44:55 AM:   In Build command from Netlify app:
10:44:55 AM:   parcel build index.html
10:44:55 AM: ​
10:44:55 AM:   Resolved config
10:44:55 AM:   build:
10:44:55 AM:     command: parcel build index.html
10:44:55 AM:     commandOrigin: ui
10:44:55 AM:     environment:
10:44:55 AM:       - CI
10:44:55 AM:     publish: /opt/build/repo
10:44:55 AM:     publishOrigin: default
10:44:55 AM: Caching artifacts
10:44:55 AM: Started saving build plugins
10:44:55 AM: Finished saving build plugins
10:44:55 AM: Started saving pip cache
10:44:55 AM: Finished saving pip cache
10:44:55 AM: Started saving emacs cask dependencies
10:44:55 AM: Finished saving emacs cask dependencies
10:44:55 AM: Started saving maven dependencies
10:44:55 AM: Finished saving maven dependencies
10:44:55 AM: Started saving boot dependencies
10:44:55 AM: Finished saving boot dependencies
10:44:55 AM: Started saving rust rustup cache
10:44:55 AM: Finished saving rust rustup cache
10:44:55 AM: Started saving go dependencies
10:44:55 AM: Finished saving go dependencies
10:44:56 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:44:56 AM: Creating deploy upload records
10:44:57 AM: Failing build: Failed to build site
10:44:57 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
10:44:57 AM: Finished processing build request in 9.738251085s

Does anyone have idea what could be causing this?

Hi @weisr

Based on the above, parcel isn’t installed. Do you have it in your package.json? Can you share the repository you are deploying from?

Hi,
I am just beginner so I hope this is what you mean by the repository:

It should be public so it should be accessible.

Thanks @weisr

That is what I meant :+1:

The project you are trying to build is in a sub-directory (Course_3_website) rather than the root of the repository. So, you need to the base directory in the build settings to Course_3_website. See Build a single site from a subdirectory or monorepo for more information.

There are also many build resources in

If you have any further issues or questions, don’t hesitate to reply.

I am not entirely sure what to do exactly. I have tried changing the bade in the setting to the course_3_website which did not help.
Could you please explain the solution a little bit more (like if I was a kid :sweat_smile:)?

The project you wish to deploy in a subdirectory, not at the repository root. Thus, you need to set the base directory in order for Netlify to detect the package.json so it can install the dependencies (parcel-bundler in this instance) so your build command will work.

E.g.

If there are still issues building, then please share the deploy log.

Well, then I understood it correctly, but it still doesn’t work.

12:07:02 AM: Build ready to start
12:07:04 AM: build-image version: 9289b698a503f132b265bd089ab40ce1d6f9e65e (focal)
12:07:04 AM: build-image tag: v4.12.0
12:07:04 AM: buildbot version: 8004afba0d79c2913deefb1ea0ee8f3ed710b828
12:07:04 AM: Fetching cached dependencies
12:07:04 AM: Starting to download cache of 6.3MB
12:07:05 AM: Finished downloading cache in 317.560911ms
12:07:05 AM: Starting to extract cache
12:07:05 AM: Finished extracting cache in 11.753046ms
12:07:05 AM: Finished fetching cache in 390.015086ms
12:07:05 AM: Starting to prepare the repo for build
12:07:05 AM: Preparing Git Reference refs/heads/main
12:07:05 AM: Parsing package.json dependencies
12:07:06 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'Course_3_website/dist' versus 'dist' in the Netlify UI
12:07:06 AM: Starting build script
12:07:06 AM: Installing dependencies
12:07:06 AM: Python version set to 2.7
12:07:07 AM: v16.17.1 is already installed.
12:07:07 AM: Now using node v16.17.1 (npm v8.15.0)
12:07:07 AM: Started restoring cached build plugins
12:07:07 AM: Finished restoring cached build plugins
12:07:07 AM: Attempting ruby version 2.7.2, read from environment
12:07:08 AM: Using ruby version 2.7.2
12:07:08 AM: Using PHP version 8.0
12:07:08 AM: No npm workspaces detected
12:07:08 AM: Started restoring cached node modules
12:07:08 AM: Finished restoring cached node modules
12:07:08 AM: Installing NPM modules using NPM version 8.15.0
12:07:08 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
12:07:08 AM: npm WARN config location in the cache, and they are managed by
12:07:08 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
12:07:09 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
12:07:09 AM: npm WARN config location in the cache, and they are managed by
12:07:09 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
12:07:11 AM: npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
12:07:11 AM: npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
12:07:11 AM: npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
12:07:11 AM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
12:07:11 AM: npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
12:07:11 AM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
12:07:12 AM: npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
12:07:12 AM: npm WARN deprecated har-validator@5.1.5: this library is no longer supported
12:07:12 AM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
12:07:12 AM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
12:07:13 AM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
12:07:13 AM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
12:07:13 AM: npm WARN deprecated parcel-bundler@1.12.4: Parcel v1 is no longer maintained. Please migrate to v2, which is published under the 'parcel' package. See https://v2.parceljs.org/getting-started/migration for details.
12:07:14 AM: npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
12:07:15 AM: added 801 packages, and audited 802 packages in 6s
12:07:15 AM: 60 packages are looking for funding
12:07:15 AM:   run `npm fund` for details
12:07:15 AM: 23 vulnerabilities (9 moderate, 14 high)
12:07:15 AM: To address issues that do not require attention, run:
12:07:15 AM:   npm audit fix
12:07:15 AM: To address all issues (including breaking changes), run:
12:07:15 AM:   npm audit fix --force
12:07:15 AM: Run `npm audit` for details.
12:07:15 AM: NPM modules installed
12:07:15 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
12:07:15 AM: npm WARN config location in the cache, and they are managed by
12:07:15 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
12:07:15 AM: Started restoring cached go cache
12:07:15 AM: Finished restoring cached go cache
12:07:15 AM: Installing Go version 1.17 (requested 1.17)
12:07:19 AM: unset GOOS;
12:07:19 AM: unset GOARCH;
12:07:19 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
12:07:19 AM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
12:07:19 AM: go version >&2;
12:07:19 AM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
12:07:19 AM: go version go1.17 linux/amd64
12:07:19 AM: Installing missing commands
12:07:19 AM: Verify run directory
12:07:20 AM: ​
12:07:20 AM: ────────────────────────────────────────────────────────────────
12:07:20 AM:   Netlify Build                                                 
12:07:20 AM: ────────────────────────────────────────────────────────────────
12:07:20 AM: ​
12:07:20 AM: ❯ Version
12:07:20 AM:   @netlify/build 27.20.1
12:07:20 AM: ​
12:07:20 AM: ❯ Flags
12:07:20 AM:   baseRelDir: true
12:07:20 AM:   buildId: 633f51864e2f311f3f3a0a3c
12:07:20 AM:   deployId: 633f51864e2f311f3f3a0a3e
12:07:20 AM: ​
12:07:20 AM: ❯ Current directory
12:07:20 AM:   /opt/build/repo/Course_3_website
12:07:20 AM: ​
12:07:20 AM: ❯ Config file
12:07:20 AM:   No config file was defined: using default values.
12:07:20 AM: ​
12:07:20 AM: ❯ Context
12:07:20 AM:   production
12:07:20 AM: ​
12:07:20 AM: ────────────────────────────────────────────────────────────────
12:07:20 AM:   1. Build command from Netlify app                             
12:07:20 AM: ────────────────────────────────────────────────────────────────
12:07:20 AM: ​
12:07:20 AM: $ parcel build index.html
12:07:21 AM: 🚨  /opt/build/repo/Course_3_website/images/logo.svg: Invalid Version: undefined
12:07:21 AM:     at new SemVer (/opt/build/repo/Course_3_website/node_modules/@babel/preset-env/node_modules/semver/semver.js:314:11)
12:07:21 AM:     at compare (/opt/build/repo/Course_3_website/node_modules/@babel/preset-env/node_modules/semver/semver.js:647:10)
12:07:21 AM:     at Function.lt (/opt/build/repo/Course_3_website/node_modules/@babel/preset-env/node_modules/semver/semver.js:688:10)
12:07:21 AM:     at /opt/build/repo/Course_3_website/node_modules/@babel/preset-env/lib/index.js:275:15
12:07:21 AM:     at Object.default (/opt/build/repo/Course_3_website/node_modules/@babel/helper-plugin-utils/lib/index.js:23:12)
12:07:21 AM:     at getEnvPlugins (/opt/build/repo/Course_3_website/node_modules/parcel-bundler/src/transforms/babel/env.js:62:34)
12:07:21 AM:     at getEnvConfig (/opt/build/repo/Course_3_website/node_modules/parcel-bundler/src/transforms/babel/env.js:12:25)
12:07:21 AM:     at async getBabelConfig (/opt/build/repo/Course_3_website/node_modules/parcel-bundler/src/transforms/babel/config.js:32:19)
12:07:21 AM:     at async babelTransform (/opt/build/repo/Course_3_website/node_modules/parcel-bundler/src/transforms/babel/transform.js:6:16)
12:07:21 AM:     at async JSAsset.pretransform (/opt/build/repo/Course_3_website/node_modules/parcel-bundler/src/assets/JSAsset.js:83:5)
12:07:22 AM: ​
12:07:22 AM: ────────────────────────────────────────────────────────────────
12:07:22 AM:   "build.command" failed                                        
12:07:22 AM: ────────────────────────────────────────────────────────────────
12:07:22 AM: ​
12:07:22 AM:   Error message
12:07:22 AM:   Command failed with exit code 1: parcel build index.html (https://ntl.fyi/exit-code-1)
12:07:22 AM: ​
12:07:22 AM:   Error location
12:07:22 AM:   In Build command from Netlify app:
12:07:22 AM:   parcel build index.html
12:07:22 AM: ​
12:07:22 AM:   Resolved config
12:07:22 AM:   build:
12:07:22 AM:     base: /opt/build/repo/Course_3_website
12:07:22 AM:     command: parcel build index.html
12:07:22 AM:     commandOrigin: ui
12:07:22 AM:     environment:
12:07:22 AM:       - CI
12:07:22 AM:     publish: /opt/build/repo/Course_3_website/dist
12:07:22 AM:     publishOrigin: ui
12:07:23 AM: Caching artifacts
12:07:23 AM: Creating deploy upload records
12:07:23 AM: Started saving node modules
12:07:23 AM: Finished saving node modules
12:07:23 AM: Started saving build plugins
12:07:23 AM: Finished saving build plugins
12:07:24 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:07:23 AM: Started saving pip cache
12:07:23 AM: Finished saving pip cache
12:07:23 AM: Started saving emacs cask dependencies
12:07:23 AM: Finished saving emacs cask dependencies
12:07:23 AM: Started saving maven dependencies
12:07:23 AM: Finished saving maven dependencies
12:07:23 AM: Started saving boot dependencies
12:07:23 AM: Finished saving boot dependencies
12:07:23 AM: Started saving rust rustup cache
12:07:23 AM: Finished saving rust rustup cache
12:07:23 AM: Started saving go dependencies
12:07:23 AM: Finished saving go dependencies
12:07:23 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:07:24 AM: Failing build: Failed to build site
12:07:24 AM: Finished processing build request in 19.561861342s

Is it because of the logo.svg in /images ?

Yes it is. Check out this topic which covers the same issue

1 Like

Yes!
Thank you very much for your help, it is finaly live.

Great. Happy developing.

1 Like