Deployment error build.command failed

Already for weeks I am trying to deploy my repo GitHub - ilukin89/MovieParadise-client: movie database website based on React (redux branch) on Netlify, with no success. Netlify site is: https://movie-paradise-cl.netlify.app

I am getting an error:


Build failed.
5:26:24 PM: unknown: Could not find entry: /opt/build/repo/
5:26:24 PM: ​
5:26:24 PM: ────────────────────────────────────────────────────────────────
5:26:24 PM:   "build.command" failed                                        
5:26:24 PM: ────────────────────────────────────────────────────────────────
5:26:24 PM: ​
5:26:24 PM:   Error message
5:26:24 PM:   Command failed with exit code 1: parcel build
5:26:24 PM: ​
5:26:24 PM:   Error location
5:26:24 PM:   In Build command from Netlify app:
5:26:24 PM:   parcel build
5:26:24 PM: ​
5:26:24 PM:   Resolved config
5:26:24 PM:   build:
5:26:24 PM:     command: parcel build
5:26:24 PM:     commandOrigin: ui
5:26:24 PM:     publish: /opt/build/repo/dist
5:26:24 PM:     publishOrigin: ui

Can somebody help me with this? I have been doing dev for 6 months only. I have correct settings in Netlify (redux branch) and still I am gettin gthese errors. I was using parcel for react localhost

hi there, can you post the full build log please, not just the excerpt above? thanks.

Here is the full log:

5:25:18 PM: Build ready to start
5:25:20 PM: build-image version: 122b31996ccaffd45d820a452d6227f8312110cc (focal)
5:25:20 PM: build-image tag: v4.5.3
5:25:20 PM: buildbot version: c65b8c8ccc1038236d06185c67d1fd1d10084168
5:25:20 PM: Building without cache
5:25:20 PM: Starting to prepare the repo for build
5:25:20 PM: No cached dependencies found. Cloning fresh repo
5:25:20 PM: git clone https://github.com/ilukin89/MovieParadise-client
5:25:22 PM: Preparing Git Reference refs/heads/redux
5:25:22 PM: Parsing package.json dependencies
5:25:23 PM: Starting build script
5:25:23 PM: Installing dependencies
5:25:23 PM: Python version set to 2.7
5:25:24 PM: v16.13.2 is already installed.
5:25:24 PM: Now using node v16.13.2 (npm v8.1.2)
5:25:24 PM: Started restoring cached build plugins
5:25:24 PM: Finished restoring cached build plugins
5:25:24 PM: Attempting ruby version 2.7.2, read from environment
5:25:26 PM: Using ruby version 2.7.2
5:25:26 PM: Using PHP version 8.0
5:25:26 PM: Started restoring cached node modules
5:25:26 PM: Finished restoring cached node modules
5:25:26 PM: Installing NPM modules using NPM version 8.1.2
5:25:27 PM: npm WARN old lockfile
5:25:27 PM: npm WARN old lockfile The package-lock.json file was created with an old version of npm,
5:25:27 PM: npm WARN old lockfile so supplemental metadata must be fetched from the registry.
5:25:27 PM: npm WARN old lockfile
5:25:27 PM: npm WARN old lockfile This is a one-time fix-up, please be patient...
5:25:27 PM: npm WARN old lockfile
5:25:51 PM: npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
5:25:51 PM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
5:25:51 PM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
5:25:51 PM: npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
5:25:52 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
5:25:55 PM: npm WARN deprecated redux-devtools-extension@2.13.9: Package moved to @redux-devtools/extension.
5:26:21 PM: added 1376 packages, and audited 1377 packages in 54s
5:26:21 PM: 155 packages are looking for funding
5:26:21 PM:   run `npm fund` for details
5:26:21 PM: 11 vulnerabilities (1 low, 10 high)
5:26:21 PM: To address all issues, run:
5:26:21 PM:   npm audit fix
5:26:21 PM: Run `npm audit` for details.
5:26:21 PM: NPM modules installed
5:26:21 PM: Started restoring cached go cache
5:26:21 PM: Finished restoring cached go cache
5:26:22 PM: go version go1.16.5 linux/amd64
5:26:22 PM: go version go1.16.5 linux/amd64
5:26:22 PM: Installing missing commands
5:26:22 PM: Verify run directory
5:26:23 PM: ​
5:26:23 PM: ────────────────────────────────────────────────────────────────
5:26:23 PM:   Netlify Build                                                 
5:26:23 PM: ────────────────────────────────────────────────────────────────
5:26:23 PM: ​
5:26:23 PM: ❯ Version
5:26:23 PM:   @netlify/build 26.2.0
5:26:23 PM: ​
5:26:23 PM: ❯ Flags
5:26:23 PM:   baseRelDir: true
5:26:23 PM:   buildId: 61eed2ee2880ef309072e7f3
5:26:23 PM:   deployId: 61eed2ee2880ef309072e7f5
5:26:23 PM: ​
5:26:23 PM: ❯ Current directory
5:26:23 PM:   /opt/build/repo
5:26:23 PM: ​
5:26:23 PM: ❯ Config file
5:26:23 PM:   No config file was defined: using default values.
5:26:23 PM: ​
5:26:23 PM: ❯ Context
5:26:23 PM:   production
5:26:23 PM: ​
5:26:23 PM: ────────────────────────────────────────────────────────────────
5:26:23 PM:   1. Build command from Netlify app                             
5:26:23 PM: ────────────────────────────────────────────────────────────────
5:26:23 PM: ​
5:26:23 PM: $ parcel build
5:26:24 PM: 🚨 Build failed.
5:26:24 PM: unknown: Could not find entry: /opt/build/repo/
5:26:24 PM: ​
5:26:24 PM: ────────────────────────────────────────────────────────────────
5:26:24 PM:   "build.command" failed                                        
5:26:24 PM: ────────────────────────────────────────────────────────────────
5:26:24 PM: ​
5:26:24 PM:   Error message
5:26:24 PM:   Command failed with exit code 1: parcel build
5:26:24 PM: ​
5:26:24 PM:   Error location
5:26:24 PM:   In Build command from Netlify app:
5:26:24 PM:   parcel build
5:26:24 PM: ​
5:26:24 PM:   Resolved config
5:26:24 PM:   build:
5:26:24 PM:     command: parcel build
5:26:24 PM:     commandOrigin: ui
5:26:24 PM:     publish: /opt/build/repo/dist
5:26:24 PM:     publishOrigin: ui
5:26:25 PM: Caching artifacts
5:26:25 PM: Started saving node modules
5:26:25 PM: Finished saving node modules
5:26:25 PM: Started saving build plugins
5:26:25 PM: Finished saving build plugins
5:26:25 PM: Started saving pip cache
5:26:25 PM: Finished saving pip cache
5:26:25 PM: Started saving emacs cask dependencies
5:26:25 PM: Finished saving emacs cask dependencies
5:26:25 PM: Started saving maven dependencies
5:26:25 PM: Finished saving maven dependencies
5:26:25 PM: Started saving boot dependencies
5:26:25 PM: Finished saving boot dependencies
5:26:25 PM: Started saving rust rustup cache
5:26:25 PM: Finished saving rust rustup cache
5:26:25 PM: Started saving go dependencies
5:26:25 PM: Finished saving go dependencies
5:26:27 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:26:27 PM: Creating deploy upload records
5:26:27 PM: Failing build: Failed to build site
5:26:27 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
5:26:27 PM: Finished processing build request in 1m7.488588157s```

Hi @iluki89

One thing to note is as the dist directory already exists in the repository, you could simply publish that without building the site (remove the build command from the build settings.)

If you wish to have Netlify build, could you try moving parcel from the devDependencies to the dependencies list.

1 Like

I will try. I have so many issues, including redirecting issue. I tried putting _redirects file into the src folder (I do not have public folder), but still I get 404 error

Hey @iluki89

I tried cloning the repository to test locally. Unfortunately I cannot get the app to build due to an issue with the .scss files (something to do with @parcel/transformer-sass I believe.) Running parcel serve src/index.html does work, but results in the following errors

Part of the issue too is parcel is listed under devDependencies instead of dependencies. As you are trying to build using parcel, you will need to add it under dependencies (as previously stated.)

I note you have added scripts to publish to GH Pages since your last post. Are you planning to publish there or still publish to Netlify?

Edit
The issue with .scss files on build is resolves with adding the --no-minify flag.

Hi Cole and thank you for the effort. I was in the meantime trying to publish anywhere, out of desperation lol. But it does not work even with GH pages.
I am running locally through npx parcel src/index.html.
I have installed parcel transformer-sass through npm. But netlify would always give me some new error… After installing sass, the error was with “main” in json so i removed it.

Oh ok, so I have to move parcel to dependencies - I will do that.

Your last sentence - what does it mean? what is --no-minify flag?

This is a build flag (or parameter which is now known as --no-optimize EDIT: still use --no-minify) which is read by parcel.

So if the standard build command is

parcel build src/index.html

you add the parameter/flag to the end e.g.

parcel build src/index.html --no-optimize

I just realised I too cannot run locally through Parcel anymore. This is a nightmare. I deleted gh-pages etc. but now I am getting axios node_module error (reinstallation of axios does not help either). :hot_face: what a nightmare

Yes, I found the same thing. Interestingly if I ran

parcel build src/index.html

I did not get the error. But when I added a build script to the package.json i.e.

"scripts": {
  "build": "parcel build src/index.html"
}

and then ran npm run build I did get the error. I unfortunately have not yet found solution to this.

With further testing, I may have found a solution for you @iluki89.

The solution is to switch from parcel to react-scripts.

Here’s what I have done.

Install react-scripts

npm i react-scripts

In the project root, create a public directory, then move index.html from src to public. In index.html change

<div class="app-container"></div>

to

<div id="root"></div>

as this is standard for React (though this is changeable.)

There is an issue with the <Route> components used in main-view.jsx. These need wrapping in <Routes>. To fix, change

import {
  BrowserRouter as Router,
  Route,
  Redirect,
  Switch
} from "react-router-dom";

to

import {
  BrowserRouter as Router,
  Routes,
  Route,
  Redirect,
  Switch
} from "react-router-dom";

Then in the file wrap the <Route> components in <Routes> i.e.

<Routes>
  <Route exact path="/" render={() => {
    // rest of code
  }} />
 <Route path="/register" render={() => {
    // rest of code
  }} />

    // rest of code

</Routes>

Stayiing in main-view.jsx the Redirects import from react-router-dom is incorrect. This is (now at least) Navigate so the import statement above gets changed to

import {
  BrowserRouter as Router,
  Routes,
  Route,
  Navigate,
  Switch
} from "react-router-dom";

Lastly (I think lastly) if you have changed the container in public/index.html you need to change this in src/index.jsx. If as above it now has id="root" this line

const container = document.getElementsByClassName('app-container')[0];

becomes

const container = document.getElementById('root');

Nope, one more lastly :slight_smile:
In the package.json add a build script i.e.

"scripts": {
  "build": "react-scripts build"
}

Then build using npm run build (this is the same command you will use when asking Netlify to build.)

Let me know if you run into any further issues.

I got the same error
This is my command:
“scripts”: {
“start”: “craco start”,
“build”: “craco --max_old_space_size=4096 build”,

Please advise

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!