Build not found after trying npm and yarn

Hi im NEW to netlify and just got done deploying my first site manually a couple hours ago. Then i noticed that you have github continuous integration so i tried it but i just can´t get it to work. The problem is the build.command failed.

First i tried it with npm and parcel-bundler and it didn´t work. Then i switched to yarn to see if it worked but no result.

I read a LOT of other support posts with my same problem and it just doesn´t work.

The solutions i´ve tried are:
making CI= yarn build (and npm run build with npm) correctly spaced written.
I checked that the yarn.lock and the package-lock are on my repo.

The log message i get is:
3:07:17 AM: Build ready to start
3:07:19 AM: build-image version: fa439ad1ab9393b2c0d449d8d7c033927683f4b0
3:07:19 AM: build-image tag: v4.3.0
3:07:19 AM: buildbot version: 3f87a7190e6e2f5b9d9a03246c6f8e87212ae12a
3:07:19 AM: Fetching cached dependencies
3:07:19 AM: Failed to fetch cache, continuing with build
3:07:19 AM: Starting to prepare the repo for build
3:07:19 AM: No cached dependencies found. Cloning fresh repo
3:07:19 AM: git clone GitHub - YuriAllexei/netlify-parcel-prueba: primera prueba de conexion a servidor web usando parcel y netlify
3:07:21 AM: Preparing Git Reference refs/heads/main
3:07:21 AM: Parsing package.json dependencies
3:07:22 AM: Starting build script
3:07:22 AM: Installing dependencies
3:07:22 AM: Python version set to 2.7
3:07:22 AM: Downloading and installing node v16.9.0…
3:07:22 AM: Downloading https://nodejs.org/dist/v16.9.0/node-v16.9.0-linux-x64.tar.xz
3:07:23 AM: Computing checksum with sha256sum
3:07:23 AM: Checksums matched!
3:07:26 AM: Now using node v16.9.0 (npm v7.21.1)
3:07:26 AM: Started restoring cached build plugins
3:07:26 AM: Finished restoring cached build plugins
3:07:26 AM: Attempting ruby version 2.7.2, read from environment
3:07:27 AM: Using ruby version 2.7.2
3:07:27 AM: Using PHP version 8.0
3:07:27 AM: Started restoring cached yarn cache
3:07:27 AM: Finished restoring cached yarn cache
3:07:27 AM: Installing yarn at version 1.22.10
3:07:27 AM: Installing Yarn!
3:07:27 AM: > Downloading tarball…
3:07:27 AM: [1/2]: 3:07:27 AM: % Total % Received % Xferd Average Speed Time Time Time Current
3:07:27 AM: Dload Upload Total Spent Left Speed
3:07:28 AM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
3:07:28 AM: 100 81 100 81 0 0 794 0 --:–:-- --:–:-- --:–:-- 794
3:07:28 AM: 100 95 100 95 0 0 250 0 --:–:-- --:–:-- --:–:-- 250
3:07:28 AM: 100 626 100 626 0 0 1290 0 --:–:-- --:–:-- --:–:-- 1290
3:07:28 AM: 100 1215k 100 1215k 0 0 2033k 0 --:–:-- --:–:-- --:–:-- 2033k

3:07:28 AM: % Total % Received % Xferd Average Speed Time Time Time Current
3:07:28 AM: Dload Upload Total Spent Left Speed
3:07:28 AM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
3:07:28 AM: 100 85 100 85 0 0 2125 0 --:–:-- --:–:-- --:–:-- 2125
3:07:28 AM: 100 99 100 99 0 0 1237 0 --:–:-- --:–:-- --:–:-- 1237
3:07:28 AM: 100 630 100 630 0 0 5833 0 --:–:-- --:–:-- --:–:-- 5833
3:07:28 AM: 100 832 100 832 0 0 6991 0 --:–:-- --:–:-- --:–:-- 6991
3:07:28 AM: > Verifying integrity…
3:07:28 AM: gpg: Signature made Fri 02 Oct 2020 11:17:27 AM UTC
3:07:28 AM: gpg: using RSA key 6D98490C6F1ACDDD448E45954F77679369475BAA
3:07:28 AM: gpg: Good signature from “Yarn Packaging yarn@dan.cx” [unknown]
3:07:28 AM: gpg: WARNING: This key is not certified with a trusted signature!
3:07:28 AM: gpg: There is no indication that the signature belongs to the owner.
3:07:28 AM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
3:07:28 AM: Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA
3:07:28 AM: > GPG signature looks good
3:07:28 AM: > Extracting to ~/.yarn…
3:07:28 AM: > Adding to $PATH…
3:07:29 AM: > Successfully installed Yarn 1.22.10! Please open another terminal where the yarn command will now be available.
3:07:29 AM: No yarn workspaces detected
3:07:29 AM: Started restoring cached node modules
3:07:29 AM: Finished restoring cached node modules
3:07:29 AM: Installing NPM modules using Yarn version 1.22.10
3:07:30 AM: yarn install v1.22.10
3:07:30 AM: [1/4] Resolving packages…
3:07:30 AM: [2/4] Fetching packages…
3:07:40 AM: info fsevents@1.2.13: The platform “linux” is incompatible with this module.
3:07:40 AM: info “fsevents@1.2.13” is an optional dependency and failed compatibility check. Excluding it from installation.
3:07:40 AM: [3/4] Linking dependencies…
3:07:45 AM: [4/4] Building fresh packages…
3:07:46 AM: Done in 16.41s.
3:07:46 AM: NPM modules installed using Yarn
3:07:46 AM: Started restoring cached go cache
3:07:46 AM: Finished restoring cached go cache
3:07:46 AM: go version go1.16.5 linux/amd64
3:07:46 AM: go version go1.16.5 linux/amd64
3:07:46 AM: Installing missing commands
3:07:46 AM: Verify run directory
3:07:48 AM: ​
3:07:48 AM: ────────────────────────────────────────────────────────────────
3:07:48 AM: Netlify Build
3:07:48 AM: ────────────────────────────────────────────────────────────────
3:07:48 AM: ​
3:07:48 AM: ❯ Version
3:07:48 AM: @netlify/build 18.8.0
3:07:48 AM: ​
3:07:48 AM: ❯ Flags
3:07:48 AM: baseRelDir: true
3:07:48 AM: buildId: 6139c0b582ba86b4fa8fa149
3:07:48 AM: deployId: 6139c0b582ba86b4fa8fa14b
3:07:48 AM: ​
3:07:48 AM: ❯ Current directory
3:07:48 AM: /opt/build/repo
3:07:48 AM: ​
3:07:48 AM: ❯ Config file
3:07:48 AM: No config file was defined: using default values.
3:07:48 AM: ​
3:07:48 AM: ❯ Context
3:07:48 AM: production
3:07:48 AM: ​
3:07:48 AM: ────────────────────────────────────────────────────────────────
3:07:48 AM: 1. Build command from Netlify app
3:07:48 AM: ────────────────────────────────────────────────────────────────
3:07:48 AM: ​
3:07:48 AM: $ yarn build
3:07:48 AM: yarn run v1.22.10
3:07:48 AM: $ parcel build src/index.html
3:07:50 AM: :rotating_light: /opt/build/repo/src/js/script.js:1:22: Cannot resolve dependency ‘lodash-es’
3:07:50 AM: > 1 | import cloneDeep from “lodash-es”;
3:07:50 AM: | ^
3:07:50 AM: 2 |
3:07:50 AM: 3 | console.log(“bambambgam”);
3:07:50 AM: 4 |
3:07:51 AM: error Command failed with exit code 1.

3:07:51 AM: ​
3:07:51 AM: ────────────────────────────────────────────────────────────────
3:07:51 AM: “build.command” failed
3:07:51 AM: ────────────────────────────────────────────────────────────────
3:07:51 AM: ​
3:07:51 AM: Error message
3:07:51 AM: Command failed with exit code 1: yarn build
3:07:51 AM: ​
3:07:51 AM: Error location
3:07:51 AM: In Build command from Netlify app:
3:07:51 AM: yarn build
3:07:51 AM: ​
3:07:51 AM: Resolved config
3:07:51 AM: build:
3:07:51 AM: command: yarn build
3:07:51 AM: commandOrigin: ui
3:07:51 AM: publish: /opt/build/repo/dist
3:07:51 AM: publishOrigin: ui
3:07:51 AM: Caching artifacts
3:07:51 AM: Started saving node modules
3:07:51 AM: Finished saving node modules
3:07:51 AM: Started saving build plugins
3:07:51 AM: Finished saving build plugins
3:07:51 AM: Started saving yarn cache
3:07:53 AM: Finished saving yarn cache
3:07:53 AM: Started saving pip cache
3:07:53 AM: Finished saving pip cache
3:07:53 AM: Started saving emacs cask dependencies
3:07:53 AM: Finished saving emacs cask dependencies
3:07:53 AM: Started saving maven dependencies
3:07:53 AM: Finished saving maven dependencies
3:07:53 AM: Started saving boot dependencies
3:07:53 AM: Finished saving boot dependencies
3:07:53 AM: Started saving rust rustup cache
3:07:53 AM: Finished saving rust rustup cache
3:07:53 AM: Started saving go dependencies
3:07:53 AM: Finished saving go dependencies
3:07:56 AM: Creating deploy upload records
3:07:56 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:07:57 AM: Failing build: Failed to build site
3:07:57 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
3:07:57 AM: Finished processing build request in 38.008916505s

My package.json is:
{

“name”: “modulos”,

“version”: “1.0.0”,

“main”: “index.js”,

“repository”: “GitHub - YuriAllexei/netlify-parcel-prueba: primera prueba de conexion a servidor web usando parcel y netlify”,

“author”: “YuriAllexei yurialexei@ciencias.unam.mx”,

“scripts”: {

"dev": "parcel src/index.html",

"build": "parcel build src/index.html"

},

“license”: “MIT”,

“devDependencies”: {

"parcel-bundler": "^1.12.5"

}

}

My repo looks like this:

Please help i´ve been trying to make this work for hours now and read like 20 support posts but no luck :frowning:
Perry pls save me

Welcome to the forums @YuriAllexei

You don’t have to. You can also use Netlify Drop (see docs) if you have a site that is already built.

In src/js/script.js you have

import cloneDeep from "lodash-es";

however lodash-es does not exist as a dependency (or devDependency) in your package.json

Try adding it as a dependency as re-deploy.

i was thinking exactly that the problem was that!! And as you said i added it to my package.json but i have a question :upside_down_face: isn´t the package-bundler (parcel) supposed to do that for me? in the video i saw the guy didn´t need to manually add his imports to the dependencies in the json im really confused by this

Oh and yes it worked! but what i was trying to do is by using the bundler to make the dependencies automatically declared.

Hi @YuriAllexei,

The role of the bundler is the bundle the dependencies, but you need to install them for the bundler to be able to do its job. By adding the dependency to your package.json, you’re asking npm to install the dependency and the bundler can then access it.

1 Like

As per parcel documentation

This only occurs in development (using serve or watch ), however in production (using build ) autoinstall is disabled to prevent unwanted side-effects on deployment.

Only in dev mode. Not when building.

1 Like