Constant failed deployments on new project

Hi there :slight_smile:

Lately my builds fails on Netlify, but it builds locally on my computer fine.

I already try this:

  • add netlify.toml to my project
  • update devDependencies and dependencies:
    β€œdevDependencies”: {
    β€œ@11ty/eleventy”: β€œ^0.11.1”,
    β€œhtml-minifier”: β€œ^4.0.0”,
    β€œlaravel-mix”: β€œ^6.0.9”,
    β€œlaravel-mix-purgecss”: β€œ^6.0.0”,
    β€œresolve-url-loader”: β€œ^3.1.2”,
    β€œsass”: β€œ^1.32.4”,
    β€œsass-loader”: β€œ^10.1.1”,
    β€œvue-template-compiler”: β€œ^2.6.12”
    },
    β€œdependencies”: {
    β€œautoprefixer”: β€œ^10.2.1”,
    β€œcore-js”: β€œ^3.8.2”,
    β€œpostcss”: β€œ^8.2.4”,
    β€œtailwindcss”: β€œ^2.0.2”
    }
    }

My project:
https://competent-booth-2a7dc0.netlify.app

The Build logs:
11:03:05 AM: Build ready to start
11:03:07 AM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
11:03:07 AM: build-image tag: v3.6.0
11:03:07 AM: buildbot version: a706ec7a557bcc28584843816a376a10c08955ca
11:03:07 AM: Building without cache
11:03:07 AM: Starting to prepare the repo for build
11:03:08 AM: No cached dependencies found. Cloning fresh repo
11:03:08 AM: git clone git@gitlab.com:ferreiraf/gty
11:03:11 AM: Preparing Git Reference refs/heads/master
11:03:13 AM: Starting build script
11:03:13 AM: Installing dependencies
11:03:13 AM: Python version set to 2.7
11:03:14 AM: v12.18.0 is already installed.
11:03:15 AM: Now using node v12.18.0 (npm v6.14.4)
11:03:15 AM: Started restoring cached build plugins
11:03:15 AM: Finished restoring cached build plugins
11:03:15 AM: Attempting ruby version 2.7.1, read from environment
11:03:17 AM: Using ruby version 2.7.1
11:03:17 AM: Using PHP version 5.6
11:03:17 AM: Started restoring cached node modules
11:03:17 AM: Finished restoring cached node modules
11:03:18 AM: Installing NPM modules using NPM version 6.14.4
11:03:23 AM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
11:03:27 AM: npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
11:03:30 AM: npm WARN deprecated urix@0.1.0: Please see GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
11:03:33 AM: npm WARN deprecated resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
11:03:35 AM: npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
11:04:04 AM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
11:04:04 AM: > node -e β€œtry{require(β€˜./postinstall’)}catch(e){}”
11:04:05 AM: > ejs@2.7.4 postinstall /opt/build/repo/node_modules/ejs
11:04:05 AM: > node ./postinstall.js
11:04:05 AM: > core-js@3.8.2 postinstall /opt/build/repo/node_modules/core-js
11:04:05 AM: > node -e β€œtry{require(β€˜./postinstall’)}catch(e){}”
11:04:06 AM: npm notice created a lockfile as package-lock.json. You should commit this file.
11:04:06 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/chokidar/node_modules/fsevents):
11:04:06 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {β€œos”:β€œdarwin”,β€œarch”:β€œany”} (current: {β€œos”:β€œlinux”,β€œarch”:β€œx64”})
11:04:06 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/@types/browser-sync/node_modules/chokidar/node_modules/fsevents):
11:04:06 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {β€œos”:β€œdarwin”,β€œarch”:β€œany”} (current: {β€œos”:β€œlinux”,β€œarch”:β€œx64”})
11:04:06 AM: added 1596 packages from 760 contributors and audited 1598 packages in 47.995s
11:04:07 AM: 94 packages are looking for funding
11:04:07 AM: run npm fund for details
11:04:07 AM: found 0 vulnerabilities
11:04:07 AM: NPM modules installed
11:04:08 AM: Started restoring cached go cache
11:04:08 AM: Finished restoring cached go cache
11:04:08 AM: go version go1.14.4 linux/amd64
11:04:08 AM: go version go1.14.4 linux/amd64
11:04:08 AM: Installing missing commands
11:04:08 AM: Verify run directory
11:04:10 AM: ​
11:04:10 AM: ────────────────────────────────────────────────────────────────
11:04:10 AM: Netlify Build
11:04:10 AM: ────────────────────────────────────────────────────────────────
11:04:10 AM: ​
11:04:10 AM: ❯ Version
11:04:10 AM: @netlify/build 8.0.3
11:04:10 AM: ​
11:04:10 AM: ❯ Flags
11:04:10 AM: deployId: 5ffd81e94c4f14f1e5c22dd2
11:04:10 AM: mode: buildbot
11:04:10 AM: ​
11:04:10 AM: ❯ Current directory
11:04:10 AM: /opt/build/repo
11:04:10 AM: ​
11:04:10 AM: ❯ Config file
11:04:10 AM: /opt/build/repo/netlify.toml
11:04:10 AM: ​
11:04:10 AM: ❯ Context
11:04:10 AM: production
11:04:10 AM: ​
11:04:10 AM: ────────────────────────────────────────────────────────────────
11:04:10 AM: 1. build.command from netlify.toml
11:04:10 AM: ────────────────────────────────────────────────────────────────
11:04:10 AM: ​
11:04:10 AM: $ npm run production
11:04:10 AM: > gty@3.0.0 production /opt/build/repo
11:04:10 AM: > NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js && npx @11ty/eleventy --config=eleventy.config.js
11:04:10 AM: error: unknown option β€˜β€“hide-modules’
11:04:10 AM: [webpack-cli] Run β€˜webpack --help’ to see available commands and options
11:04:10 AM: npm ERR! code ELIFECYCLE
11:04:10 AM: npm ERR! errno 2
11:04:10 AM: npm ERR! gty@3.0.0 production: NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js && npx @11ty/eleventy --config=eleventy.config.js
11:04:10 AM: npm ERR! Exit status 2
11:04:10 AM: npm ERR!
11:04:10 AM: npm ERR! Failed at the gty@3.0.0 production script.
11:04:10 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
11:04:10 AM: npm ERR! A complete log of this run can be found in:
11:04:10 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-01-12T11_04_10_968Z-debug.log
11:04:10 AM: ​
11:04:10 AM: ────────────────────────────────────────────────────────────────
11:04:10 AM: β€œbuild.command” failed
11:04:10 AM: ────────────────────────────────────────────────────────────────
11:04:10 AM: ​
11:04:10 AM: Error message
11:04:10 AM: Command failed with exit code 2: npm run production
11:04:10 AM: ​
11:04:10 AM: Error location
11:04:10 AM: In build.command from netlify.toml:
11:04:10 AM: npm run production
11:04:10 AM: ​
11:04:10 AM: Resolved config
11:04:10 AM: build:
11:04:10 AM: command: npm run production
11:04:10 AM: commandOrigin: config
11:04:10 AM: publish: /opt/build/repo/dist
11:04:11 AM: Caching artifacts
11:04:11 AM: Started saving node modules
11:04:11 AM: Finished saving node modules
11:04:11 AM: Started saving build plugins
11:04:11 AM: Finished saving build plugins
11:04:11 AM: Started saving pip cache
11:04:11 AM: Finished saving pip cache
11:04:11 AM: Started saving emacs cask dependencies
11:04:11 AM: Finished saving emacs cask dependencies
11:04:11 AM: Started saving maven dependencies
11:04:11 AM: Finished saving maven dependencies
11:04:11 AM: Started saving boot dependencies
11:04:11 AM: Finished saving boot dependencies
11:04:11 AM: Started saving rust rustup cache
11:04:11 AM: Finished saving rust rustup cache
11:04:11 AM: Started saving rust cargo bin cache
11:04:11 AM: Finished saving rust cargo bin cache
11:04:11 AM: Started saving go dependencies
11:04:11 AM: Finished saving go dependencies
11:04:14 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:04:14 AM: Failing build: Failed to build site
11:04:14 AM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
11:04:14 AM: Finished processing build request in 1m7.102839675s

Could you help me?
Thank you!

i just try this:

uninstall webpack
delete node module folder
install webpack again
npm install

And nothing happen :frowning:
Can’t deploye this project with netlify.
But like this morning, it builds locally on my computer fine.

:upside_down_face: :thinking: :flushed:

8:29:42 PM: Build ready to start
8:29:43 PM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
8:29:43 PM: build-image tag: v3.6.0
8:29:43 PM: buildbot version: a706ec7a557bcc28584843816a376a10c08955ca
8:29:43 PM: Fetching cached dependencies
8:29:43 PM: Failed to fetch cache, continuing with build
8:29:43 PM: Starting to prepare the repo for build
8:29:44 PM: No cached dependencies found. Cloning fresh repo
8:29:44 PM: git clone git@gitlab.com:ferreiraf/gty
8:29:45 PM: Preparing Git Reference refs/heads/master
8:29:47 PM: Starting build script
8:29:47 PM: Installing dependencies
8:29:47 PM: Python version set to 2.7
8:29:48 PM: v12.18.0 is already installed.
8:29:48 PM: Now using node v12.18.0 (npm v6.14.4)
8:29:48 PM: Started restoring cached build plugins
8:29:48 PM: Finished restoring cached build plugins
8:29:48 PM: Attempting ruby version 2.7.1, read from environment
8:29:50 PM: Using ruby version 2.7.1
8:29:50 PM: Using PHP version 5.6
8:29:50 PM: Started restoring cached node modules
8:29:50 PM: Finished restoring cached node modules
8:29:50 PM: Installing NPM modules using NPM version 6.14.4
8:29:55 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
8:29:58 PM: npm WARN deprecated urix@0.1.0: Please see GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
8:29:58 PM: npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
8:30:01 PM: npm WARN deprecated resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
8:30:04 PM: npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
8:30:28 PM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
8:30:28 PM: > node -e β€œtry{require(β€˜./postinstall’)}catch(e){}”
8:30:28 PM: > ejs@2.7.4 postinstall /opt/build/repo/node_modules/ejs
8:30:28 PM: > node ./postinstall.js
8:30:29 PM: > core-js@3.8.2 postinstall /opt/build/repo/node_modules/core-js
8:30:29 PM: > node -e β€œtry{require(β€˜./postinstall’)}catch(e){}”
8:30:30 PM: npm notice created a lockfile as package-lock.json. You should commit this file.
8:30:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/chokidar/node_modules/fsevents):
8:30:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {β€œos”:β€œdarwin”,β€œarch”:β€œany”} (current: {β€œos”:β€œlinux”,β€œarch”:β€œx64”})
8:30:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/@types/browser-sync/node_modules/chokidar/node_modules/fsevents):
8:30:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {β€œos”:β€œdarwin”,β€œarch”:β€œany”} (current: {β€œos”:β€œlinux”,β€œarch”:β€œx64”})
8:30:30 PM: added 1596 packages from 760 contributors and audited 1599 packages in 39.258s
8:30:31 PM: 94 packages are looking for funding
8:30:31 PM: run npm fund for details
8:30:31 PM: found 0 vulnerabilities
8:30:31 PM: NPM modules installed
8:30:31 PM: Started restoring cached go cache
8:30:31 PM: Finished restoring cached go cache
8:30:31 PM: go version go1.14.4 linux/amd64
8:30:31 PM: go version go1.14.4 linux/amd64
8:30:31 PM: Installing missing commands
8:30:31 PM: Verify run directory
8:30:33 PM: ​
8:30:33 PM: ────────────────────────────────────────────────────────────────
8:30:33 PM: Netlify Build
8:30:33 PM: ────────────────────────────────────────────────────────────────
8:30:33 PM: ​
8:30:33 PM: ❯ Version
8:30:33 PM: @netlify/build 8.0.3
8:30:33 PM: ​
8:30:33 PM: ❯ Flags
8:30:33 PM: deployId: 5ffe06b59535660007dc2aae
8:30:33 PM: mode: buildbot
8:30:33 PM: ​
8:30:33 PM: ❯ Current directory
8:30:33 PM: /opt/build/repo
8:30:33 PM: ​
8:30:33 PM: ❯ Config file
8:30:33 PM: /opt/build/repo/netlify.toml
8:30:33 PM: ​
8:30:33 PM: ❯ Context
8:30:33 PM: production
8:30:33 PM: ​
8:30:33 PM: ────────────────────────────────────────────────────────────────
8:30:33 PM: 1. build.command from netlify.toml
8:30:33 PM: ────────────────────────────────────────────────────────────────
8:30:33 PM: ​
8:30:33 PM: $ npm run production
8:30:33 PM: > gty@3.0.0 production /opt/build/repo
8:30:33 PM: > NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js && npx @11ty/eleventy --config=eleventy.config.js
8:30:34 PM: error: unknown option β€˜β€“hide-modules’
8:30:34 PM: [webpack-cli] Run β€˜webpack --help’ to see available commands and options
8:30:34 PM: npm ERR! code ELIFECYCLE
8:30:34 PM: npm ERR! errno 2
8:30:34 PM: npm ERR! gty@3.0.0 production: NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js && npx @11ty/eleventy --config=eleventy.config.js
8:30:34 PM: npm ERR! Exit status 2
8:30:34 PM: npm ERR!
8:30:34 PM: npm ERR! Failed at the gty@3.0.0 production script.
8:30:34 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
8:30:34 PM: npm ERR! A complete log of this run can be found in:
8:30:34 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-01-12T20_30_34_193Z-debug.log
8:30:34 PM: ​
8:30:34 PM: ────────────────────────────────────────────────────────────────
8:30:34 PM: β€œbuild.command” failed
8:30:34 PM: ────────────────────────────────────────────────────────────────
8:30:34 PM: ​
8:30:34 PM: Error message
8:30:34 PM: Command failed with exit code 2: npm run production
8:30:34 PM: ​
8:30:34 PM: Error location
8:30:34 PM: In build.command from netlify.toml:
8:30:34 PM: npm run production
8:30:34 PM: ​
8:30:34 PM: Resolved config
8:30:34 PM: build:
8:30:34 PM: command: npm run production
8:30:34 PM: commandOrigin: config
8:30:34 PM: publish: /opt/build/repo/dist
8:30:34 PM: Caching artifacts
8:30:34 PM: Started saving node modules
8:30:34 PM: Finished saving node modules
8:30:34 PM: Started saving build plugins
8:30:34 PM: Finished saving build plugins
8:30:34 PM: Started saving pip cache
8:30:34 PM: Finished saving pip cache
8:30:34 PM: Started saving emacs cask dependencies
8:30:34 PM: Finished saving emacs cask dependencies
8:30:34 PM: Started saving maven dependencies
8:30:34 PM: Finished saving maven dependencies
8:30:34 PM: Started saving boot dependencies
8:30:34 PM: Finished saving boot dependencies
8:30:34 PM: Started saving rust rustup cache
8:30:34 PM: Finished saving rust rustup cache
8:30:34 PM: Started saving rust cargo bin cache
8:30:34 PM: Finished saving rust cargo bin cache
8:30:34 PM: Started saving go dependencies
8:30:34 PM: Finished saving go dependencies
8:30:37 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:30:37 PM: Failing build: Failed to build site
8:30:37 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
8:30:37 PM: Finished processing build request in 54.053378407s

hi there, could you post your full package.json please?

Here it is:

{
β€œname”: β€œgty”,
β€œversion”: β€œ3.0.0”,
β€œdescription”: β€œgty - A nano project built with Eleventy”,
β€œscripts”: {
β€œdev”: β€œELEVENTY_ENV=development npx @11ty/eleventy --config=eleventy.config.js --serve & webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js”,
β€œproduction”: β€œNODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js && npx @11ty/eleventy --config=eleventy.config.js”
},
β€œrepository”: {
β€œtype”: β€œgit”,
β€œurl”: β€œhttps://gitlab.com/ferreiraf/gty.git”
},
β€œauthor”: β€œhpgmotors”,
β€œlicense”: β€œMIT”,
β€œdevDependencies”: {
β€œ@11ty/eleventy”: β€œ^0.11.1”,
β€œhtml-minifier”: β€œ^4.0.0”,
β€œlaravel-mix”: β€œ^6.0.9”,
β€œlaravel-mix-purgecss”: β€œ^6.0.0”,
β€œresolve-url-loader”: β€œ^3.1.2”,
β€œsass”: β€œ^1.32.4”,
β€œsass-loader”: β€œ^10.1.1”,
β€œvue-template-compiler”: β€œ^2.6.12”,
β€œwebpack-cli”: β€œ^4.3.1”
},
β€œdependencies”: {
β€œautoprefixer”: β€œ^10.2.1”,
β€œcore-js”: β€œ^3.8.2”,
β€œpostcss”: β€œ^8.2.4”,
β€œtailwindcss”: β€œ^2.0.2”
}
}

Webpack CLI v4 + does not accept the --hide modules flag - so thats probably your issue.

Thanks you Edward :wink:

I already tried this yesterday night (maybe its not the good way to do this? :flushed:):

  • uninstall webpack
  • delete node module folder
  • install webpack again
  • npm install

But without success as you can see in logs in my last post:

8:30:33 PM: $ npm run production
8:30:33 PM: > gty@3.0.0 production /opt/build/repo
8:30:33 PM: > NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js && npx @11ty/eleventy --config=eleventy.config.js
8:30:34 PM: error: unknown option β€˜β€“hide-modules’
8:30:34 PM: [webpack-cli] Run β€˜webpack --help’ to see available commands and options
8:30:34 PM: npm ERR! code ELIFECYCLE
8:30:34 PM: npm ERR! errno 2
8:30:34 PM: npm ERR! gty@3.0.0 production: NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js && npx @11ty/eleventy --config=eleventy.config.js
8:30:34 PM: npm ERR! Exit status 2
8:30:34 PM: npm ERR!
8:30:34 PM: npm ERR! Failed at the gty@3.0.0 production script.
8:30:34 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
8:30:34 PM: npm ERR! A complete log of this run can be found in:
8:30:34 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-01-12T20_30_34_193Z-debug.log

After a second read,
i will try to delete in the package.json file the instruction you say:
--hide modules

Nop,
delete the --hide modules don’t work

i get this now:

`9:53:38 AM: ​
9:53:38 AM: $ npm run production
9:53:38 AM: > gty@3.0.0 production /opt/build/repo
9:53:38 AM: > NODE_ENV=production webpack --progress --config=node_modules/laravel-mix/setup/webpack.config.js && npx @11ty/eleventy --config=eleventy.config.js
9:53:39 AM: [webpack-cli] ReferenceError: path is not defined
9:53:39 AM:     at Object.<anonymous> (/opt/build/repo/webpack.mix.js:25:31)
9:53:39 AM:     at Module._compile (/opt/build/repo/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
9:53:39 AM:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
9:53:39 AM:     at Module.load (internal/modules/cjs/loader.js:986:32)
9:53:39 AM:     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
9:53:39 AM:     at Module.require (internal/modules/cjs/loader.js:1026:19)
9:53:39 AM:     at require (/opt/build/repo/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
9:53:39 AM:     at module.exports (/opt/build/repo/node_modules/laravel-mix/setup/webpack.config.js:4:5)
9:53:39 AM:     at /opt/build/repo/node_modules/webpack-cli/lib/webpack-cli.js:792:43
9:53:39 AM:     at Array.map (<anonymous>)
9:53:39 AM: npm ERR! code ELIFECYCLE
9:53:39 AM: npm ERR! errno 2
9:53:39 AM: npm ERR! gty@3.0.0 production: `NODE_ENV=production webpack --progress --config=node_modules/laravel-mix/setup/webpack.config.js && npx @11ty/eleventy --config=eleventy.config.js`
9:53:39 AM: npm ERR! Exit status 2
9:53:39 AM: npm ERR!
9:53:39 AM: npm ERR! Failed at the gty@3.0.0 production script.
9:53:39 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
9:53:39 AM: npm ERR! A complete log of this run can be found in:
9:53:39 AM: npm ERR!     /opt/buildhome/.npm/_logs/2021-01-13T09_53_39_856Z-debug.log
9:53:39 AM: ​
9:53:39 AM: ────────────────────────────────────────────────────────────────
9:53:39 AM:   "build.command" failed                                        
9:53:39 AM: ────────────────────────────────────────────────────────────────
9:53:39 AM: ​
9:53:39 AM:   Error message
9:53:39 AM:   Command failed with exit code 2: npm run production
9:53:39 AM: ​
9:53:39 AM:   Error location
9:53:39 AM:   In build.command from netlify.toml:
9:53:39 AM:   npm run production
9:53:39 AM: ​
9:53:39 AM:   Resolved config
9:53:39 AM:   build:
9:53:39 AM:     command: npm run production
9:53:39 AM:     commandOrigin: config
9:53:39 AM:     publish: /opt/build/repo/dist
9:53:40 AM: Caching artifacts
9:53:40 AM: Started saving node modules
9:53:40 AM: Finished saving node modules
9:53:40 AM: Started saving build plugins
9:53:40 AM: Finished saving build plugins
9:53:40 AM: Started saving pip cache
9:53:40 AM: Finished saving pip cache
9:53:40 AM: Started saving emacs cask dependencies
9:53:40 AM: Finished saving emacs cask dependencies
9:53:40 AM: Started saving maven dependencies
9:53:40 AM: Finished saving maven dependencies
9:53:40 AM: Started saving boot dependencies
9:53:40 AM: Finished saving boot dependencies
9:53:40 AM: Started saving rust rustup cache
9:53:40 AM: Finished saving rust rustup cache
9:53:40 AM: Started saving rust cargo bin cache
9:53:40 AM: Finished saving rust cargo bin cache
9:53:40 AM: Started saving go dependencies
9:53:40 AM: Finished saving go dependencies
9:53:42 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:53:42 AM: Failing build: Failed to build site
9:53:42 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
9:53:42 AM: Finished processing build request in 43.784988942s`

Hey there,
Which Node version are you using locally? I see that your build is using 12.18.0:
8:29:48 PM: v12.18.0 is already installed. If you’re using a different version locally, you can set the NODE_VERSION environment variable in the UI to match and see if that fixes things.

Here are our docs on this:

Hi jen,
thanks for your help :+1:
localy i have this node version:
node --version v14.4.0s

So that did work in that you cleared your original error which was unknown option β€˜β€“hide-modules’, now you have a new error.

New error sounds like you are using path in your webpack config without having imported it first in your config.