I've just refactored my app by creating a folder for each component with its .js and .scss file and on local it works fine (even the npm run build command).
The problem is now it gives me an error when I try to deploy it.
It says
5:25:44 PM: ./src/Components/restaurants/RestaurantInfo/RestaurantInfo.js
5:25:44 PM: Cannot find file '../../util/Review' in './src/Components/restaurants/RestaurantInfo'.
it doesn't find it because ./src/Components/restaurants/RestaurantInfo is now just a folder and it should check ./src/Components/restaurants/RestaurantInfo/RestaurantInfo instead.
I've checked all the paths and are correct, as I said on local everything works as it should but clearly something is wrong and I can't figure it out.
Here's the its url: https://restaurant-finder-redux.netlify.app/
Github repository: https://github.com/mugg84/RestaurantFinderRedux.git
and the full error:
5:25:41 PM: Build ready to start
5:25:43 PM: build-image version: ca811f47d4c1cbd1812d1eb6ecb0c977e86d1a1d
5:25:43 PM: build-image tag: v3.3.20
5:25:43 PM: buildbot version: be8ecf2af866e16fa4301cc5c14de2ccbbb21cf4
5:25:43 PM: Fetching cached dependencies
5:25:43 PM: Starting to download cache of 254.8KB
5:25:43 PM: Finished downloading cache in 74.189736ms
5:25:43 PM: Starting to extract cache
5:25:43 PM: Failed to fetch cache, continuing with build
5:25:43 PM: Starting to prepare the repo for build
5:25:44 PM: No cached dependencies found. Cloning fresh repo
5:25:44 PM: git clone git#github.com:mugg84/RestaurantFinderRedux
5:25:45 PM: Preparing Git Reference refs/heads/master
5:25:47 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'C:\Users\Turi\Desktop\project\RestaurantsRedux\build' in the Netlify UI
5:25:47 PM: Starting build script
5:25:47 PM: Installing dependencies
5:25:47 PM: Python version set to 2.7
5:25:48 PM: v12.18.0 is already installed.
5:25:49 PM: Now using node v12.18.0 (npm v6.14.4)
5:25:49 PM: Started restoring cached build plugins
5:25:49 PM: Finished restoring cached build plugins
5:25:49 PM: Attempting ruby version 2.7.1, read from environment
5:25:51 PM: Using ruby version 2.7.1
5:25:51 PM: Using PHP version 5.6
5:25:51 PM: 5.2 is already installed.
5:25:51 PM: Using Swift version 5.2
5:25:51 PM: Started restoring cached node modules
5:25:51 PM: Finished restoring cached node modules
5:25:51 PM: Installing NPM modules using NPM version 6.14.4
5:26:28 PM: > node-sass#4.14.1 install /opt/build/repo/node_modules/node-sass
5:26:28 PM: > node scripts/install.js
5:26:29 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node
5:26:29 PM: Download complete
5:26:29 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
5:26:29 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.14.1/linux-x64-72_binding.node
5:26:30 PM: > core-js#2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
5:26:30 PM: > node -e "try{require('./postinstall')}catch(e){}"
5:26:30 PM: > core-js#3.6.5 postinstall /opt/build/repo/node_modules/core-js
5:26:30 PM: > node -e "try{require('./postinstall')}catch(e){}"
5:26:30 PM: > core-js-pure#3.6.5 postinstall /opt/build/repo/node_modules/core-js-pure
5:26:30 PM: > node -e "try{require('./postinstall')}catch(e){}"
5:26:31 PM: > node-sass#4.14.1 postinstall /opt/build/repo/node_modules/node-sass
5:26:31 PM: > node scripts/build.js
5:26:31 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
5:26:31 PM: Testing binary
5:26:31 PM: Binary is fine
5:26:33 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
5:26:33 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:26:33 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
5:26:33 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:26:33 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
5:26:33 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:26:33 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/fsevents):
5:26:33 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:26:33 PM: added 1778 packages from 828 contributors and audited 1782 packages in 40.593s
5:26:35 PM: 60 packages are looking for funding
5:26:35 PM: run `npm fund` for details
5:26:35 PM: found 4985 low severity vulnerabilities
5:26:35 PM: run `npm audit fix` to fix them, or `npm audit` for details
5:26:35 PM: NPM modules installed
5:26:35 PM: Started restoring cached go cache
5:26:35 PM: Finished restoring cached go cache
5:26:35 PM: go version go1.14.4 linux/amd64
5:26:35 PM: go version go1.14.4 linux/amd64
5:26:35 PM: Installing missing commands
5:26:35 PM: Verify run directory
5:26:37 PM:
5:26:37 PM: ┌─────────────────────────────┐
5:26:37 PM: │ Netlify Build │
5:26:37 PM: └─────────────────────────────┘
5:26:37 PM:
5:26:37 PM: ❯ Version
5:26:37 PM: #netlify/build 3.0.1
5:26:37 PM:
5:26:37 PM: ❯ Flags
5:26:37 PM: deployId: 5f19ba059db363022d8ef5d1
5:26:37 PM: mode: buildbot
5:26:37 PM:
5:26:37 PM: ❯ Current directory
5:26:37 PM: /opt/build/repo
5:26:37 PM:
5:26:37 PM: ❯ Config file
5:26:37 PM: /opt/build/repo/netlify.toml
5:26:37 PM:
5:26:37 PM: ❯ Context
5:26:37 PM: production
5:26:37 PM:
5:26:37 PM: ┌───────────────────────────────────┐
5:26:37 PM: │ 1. Build command from Netlify app │
5:26:37 PM: └───────────────────────────────────┘
5:26:37 PM:
5:26:37 PM: $ npm run build
5:26:37 PM: > RestaurantFinder#0.1.0 build /opt/build/repo
5:26:37 PM: > react-scripts build
5:26:38 PM: Creating an optimized production build...
5:26:44 PM: Failed to compile.
5:26:44 PM:
5:26:44 PM: ./src/Components/restaurants/RestaurantInfo/RestaurantInfo.js
5:26:44 PM: Cannot find file '../../util/Review' in './src/Components/restaurants/RestaurantInfo'.
5:26:44 PM: npm ERR! code ELIFECYCLE
5:26:44 PM: npm ERR! errno 1
5:26:44 PM: npm ERR! RestaurantFinder#0.1.0 build: `react-scripts build`
5:26:44 PM: npm ERR! Exit status 1
5:26:44 PM: npm ERR!
5:26:44 PM: npm ERR! Failed at the RestaurantFinder#0.1.0 build script.
5:26:44 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
5:26:44 PM: npm ERR! A complete log of this run can be found in:
5:26:44 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-07-23T16_26_44_363Z-debug.log
5:26:44 PM:
5:26:44 PM: If the build failed with a warning about "process.env.CI = true", this is due to "create-react-app" treating warnings as errors when in CI. In order to fix this problem, please either:
5:26:44 PM: - Fix the issues highlighted by the warnings above.
5:26:44 PM: - Or modify the "scripts.build" command in your "package.json" from "react-scripts build" to "CI= react-scripts build"
5:26:44 PM: More information can be found at https://docs.netlify.com/configure-builds/troubleshooting-tips/#build-fails-on-warning-message
5:26:44 PM:
5:26:44 PM: ┌─────────────────────────────┐
5:26:44 PM: │ "build.command" failed │
5:26:44 PM: └─────────────────────────────┘
5:26:44 PM:
5:26:44 PM: Error message
5:26:44 PM: Command failed with exit code 1: npm run build
5:26:44 PM:
5:26:44 PM: Error location
5:26:44 PM: In Build command from Netlify app:
5:26:44 PM: npm run build
5:26:44 PM:
5:26:44 PM: Resolved config
5:26:44 PM: build:
5:26:44 PM: command: npm run build
5:26:44 PM: commandOrigin: ui
5:26:44 PM: environment:
5:26:44 PM: - REACT_APP_GOOGLE_API_KEY
5:26:44 PM: - REACT_APP_MAILCHIMP_URL
5:26:44 PM: - REACT_APP_YELP_API_KEY
5:26:44 PM: publish: /opt/build/repo/build
5:26:44 PM: Caching artifacts
5:26:44 PM: Started saving node modules
5:26:44 PM: Finished saving node modules
5:26:44 PM: Started saving build plugins
5:26:44 PM: Finished saving build plugins
5:26:44 PM: Started saving pip cache
5:26:44 PM: Finished saving pip cache
5:26:44 PM: Started saving emacs cask dependencies
5:26:44 PM: Finished saving emacs cask dependencies
5:26:44 PM: Started saving maven dependencies
5:26:44 PM: Finished saving maven dependencies
5:26:44 PM: Started saving boot dependencies
5:26:44 PM: Finished saving boot dependencies
5:26:44 PM: Started saving go dependencies
5:26:44 PM: Finished saving go dependencies
5:26:47 PM: Error running command: Build script returned non-zero exit code: 1
5:26:47 PM: Failing build: Failed to build site
5:26:47 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
5:26:47 PM: Finished processing build request in 1m4.47397412s
Thanks for your help!
The issue was a discrepancy between the repository name of one folder and the local one, specifically the folder util.
In the repository it was uppercase, Util, while locally util and that was causing the issue.
That explains why locally npm run build was working bit it wasn't in deployment.
Related
Below is the message I got.
I have tried other solutions such as changing the deployed setting 'CI=npm build run' and set a new environmental variable CI false But none of them worked.
below is the version without setting the 'CI=npm build run' but set CI to false.
$ npm run build
1:51:55 PM: > anqi-portfolio#0.1.0 build
1:51:55 PM: > react-scripts build
1:51:56 PM: Creating an optimized production build...
1:51:56 PM: Failed to compile.
1:51:56 PM:
1:51:56 PM: Module not found: Error: Can't resolve '../src/pages/AboutPage' in '/opt/build/repo/src'
1:51:56 PM:
1:51:56 PM: "build.command" failed
1:51:56 PM: ────────────────────────────────────────────────────────────────
1:51:56 PM:
1:51:56 PM: Error message
1:51:56 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
1:51:56 PM:
1:51:56 PM: Error location
1:51:56 PM: In Build command from Netlify app:
1:51:56 PM: npm run build
1:51:56 PM:
1:51:56 PM: Resolved config
1:51:56 PM: build:
1:51:56 PM: command: npm run build
1:51:56 PM: commandOrigin: ui
1:51:56 PM: environment:
1:51:56 PM: - CI
1:51:56 PM: publish: /opt/build/repo/build
1:51:56 PM: publishOrigin: ui
1:51:57 PM: Caching artifacts
1:51:57 PM: Started saving node modules
1:51:57 PM: Finished saving node modules
1:51:57 PM: Started saving build plugins
1:51:57 PM: Finished saving build plugins
1:51:57 PM: Started saving pip cache
1:51:57 PM: Finished saving pip cache
1:51:57 PM: Started saving emacs cask dependencies
1:51:57 PM: Finished saving emacs cask dependencies
1:51:57 PM: Started saving maven dependencies
1:51:58 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:51:57 PM: Finished saving maven dependencies
1:51:57 PM: Started saving boot dependencies
1:51:57 PM: Finished saving boot dependencies
1:51:57 PM: Started saving rust rustup cache
1:51:57 PM: Finished saving rust rustup cache
1:51:57 PM: Started saving go dependencies
1:51:57 PM: Finished saving go dependencies
1:51:58 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:51:58 PM: Failing build: Failed to build site
1:51:58 PM: Finished processing build request in 30.452339066s
My Gatsby blog is deployed on Netlify. Everything was working fine, until yesterday when the deployment failed for the following reason:
WebpackError: TypeError: merge is not a function (from plugin: gatsby-plugin-react-helmet)
The complete deploy log is shown below:
11:26:10 PM: build-image version: d7b3813f01c06610bc1723ff1b22446513ee7941 (focal)
11:26:10 PM: build-image tag: v4.14.3
11:26:10 PM: buildbot version: be0925a1b4e8f8d2c5a767f3e0decf8856cad273
11:26:11 PM: Fetching cached dependencies
11:26:11 PM: Failed to fetch cache, continuing with build
11:26:11 PM: Starting to prepare the repo for build
11:26:11 PM: No cached dependencies found. Cloning fresh repo
11:26:11 PM: git clone https://github.com/sundaray/hemanta.io
11:26:12 PM: Preparing Git Reference refs/heads/master
11:26:13 PM: Parsing package.json dependencies
11:26:14 PM: Starting build script
11:26:14 PM: Installing dependencies
11:26:14 PM: Python version set to 2.7
11:26:14 PM: Downloading and installing node v12.18.0...
11:26:14 PM: Downloading https://nodejs.org/dist/v12.18.0/node-v12.18.0-linux-x64.tar.xz...
11:26:15 PM: Computing checksum with sha256sum
11:26:15 PM: Checksums matched!
11:26:16 PM: Now using node v12.18.0 (npm v6.14.4)
11:26:16 PM: Started restoring cached build plugins
11:26:16 PM: Finished restoring cached build plugins
11:26:16 PM: Attempting ruby version 2.7.1, read from environment
11:26:16 PM: Required ruby-2.7.1 is not installed - installing.
11:26:17 PM: Searching for binary rubies, this might take some time.
11:26:17 PM: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.7.1.tar.bz2
11:26:17 PM: Checking requirements for ubuntu.
11:26:17 PM: Requirements installation successful.
11:26:17 PM: ruby-2.7.1 - #configure
11:26:17 PM: ruby-2.7.1 - #download
11:26:17 PM: ruby-2.7.1 - #validate archive
11:26:20 PM: ruby-2.7.1 - #extract
11:26:22 PM: ruby-2.7.1 - #validate binary
11:26:22 PM: ruby-2.7.1 - #setup
11:26:23 PM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1#global
11:26:23 PM: ruby-2.7.1 - #importing gemset /opt/buildhome/.rvm/gemsets/global.gems........................................
11:26:23 PM: ruby-2.7.1 - #generating global wrappers........
11:26:23 PM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1
11:26:23 PM: ruby-2.7.1 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
11:26:23 PM: ruby-2.7.1 - #generating default wrappers........
11:26:23 PM: Using /opt/buildhome/.rvm/gems/ruby-2.7.1
11:26:24 PM: Using ruby version 2.7.1
11:26:24 PM: Using PHP version 8.0
11:26:24 PM: No npm workspaces detected
11:26:24 PM: Started restoring cached node modules
11:26:24 PM: Finished restoring cached node modules
11:26:24 PM: Installing NPM modules using NPM version 6.14.4
11:26:29 PM: npm WARN deprecated multer#1.4.4: Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops support for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you need support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x release line, whilst maintaining compatibility with Node.js 0.10.
11:26:29 PM: 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.
11:26:30 PM: npm WARN deprecated svgo#1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
11:26:34 PM: npm WARN deprecated gatsby-recipes#0.25.0: gatsby-recipes has been removed from gatsby/gatsby-cli >=4.5.0. Update to gatsby#latest/gatsby-cli#latest to use versions without gatsby-recipes. This package will no longer receive updates.
11:26:36 PM: npm WARN deprecated async-cache#1.1.0: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
11:26:36 PM: 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
11:26:37 PM: npm WARN deprecated querystring#0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
11:26:40 PM: npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
11:26:40 PM: npm WARN deprecated #hapi/joi#15.1.1: Switch to 'npm install joi'
11:26:43 PM: npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
11:26:43 PM: npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
11:26:43 PM: npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
11:26:44 PM: npm WARN deprecated subscriptions-transport-ws#0.9.19: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
11:26:47 PM: npm WARN deprecated source-map-resolve#0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
11:26:49 PM: npm WARN deprecated source-map-url#0.4.1: See https://github.com/lydell/source-map-url#deprecated
11:26:49 PM: npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
11:26:49 PM: npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
11:40:12 PM: > sharp#0.29.3 install /opt/build/repo/node_modules/sharp
11:40:12 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
11:40:13 PM: sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.11.3/libvips-8.11.3-linux-x64.tar.br
11:40:14 PM: > #fortawesome/fontawesome-common-types#0.2.36 postinstall /opt/build/repo/node_modules/#fortawesome/fontawesome-common-types
11:40:14 PM: > node attribution.js
11:40:14 PM: Font Awesome Free 0.2.36 by #fontawesome - https://fontawesome.com
11:40:14 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
11:40:14 PM: > core-js#3.26.0 postinstall /opt/build/repo/node_modules/core-js
11:40:14 PM: > node -e "try{require('./postinstall')}catch(e){}"
11:40:14 PM: > core-js-pure#3.26.0 postinstall /opt/build/repo/node_modules/core-js-pure
11:40:14 PM: > node -e "try{require('./postinstall')}catch(e){}"
11:40:15 PM: > es5-ext#0.10.62 postinstall /opt/build/repo/node_modules/es5-ext
11:40:15 PM: > node -e "try{require('./_postinstall')}catch(e){}" || exit 0
11:40:15 PM: > gatsby-telemetry#2.14.0 postinstall /opt/build/repo/node_modules/gatsby-telemetry
11:40:15 PM: > node src/postinstall.js || true
11:40:15 PM: > gatsby-cli#3.14.2 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
11:40:15 PM: > node scripts/postinstall.js
11:40:15 PM: > #fortawesome/fontawesome-svg-core#1.2.36 postinstall /opt/build/repo/node_modules/#fortawesome/fontawesome-svg-core
11:40:15 PM: > node attribution.js
11:40:15 PM: Font Awesome Free 1.2.36 by #fontawesome - https://fontawesome.com
11:40:15 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
11:40:15 PM: > #fortawesome/free-solid-svg-icons#5.15.4 postinstall /opt/build/repo/node_modules/#fortawesome/free-solid-svg-icons
11:40:15 PM: > node attribution.js
11:40:15 PM: Font Awesome Free 5.15.4 by #fontawesome - https://fontawesome.com
11:40:15 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
11:40:15 PM: > gatsby#3.14.6 postinstall /opt/build/repo/node_modules/gatsby
11:40:15 PM: > node scripts/postinstall.js
11:40:16 PM: npm notice created a lockfile as package-lock.json. You should commit this file.
11:40:16 PM: npm WARN notsup Unsupported engine for gatsby-remark-katex#6.24.0: wanted: {"node":">=14.15.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
11:40:16 PM: npm WARN notsup Not compatible with your version of node/npm: gatsby-remark-katex#6.24.0
11:40:16 PM: npm WARN notsup Unsupported engine for react-hook-form#7.39.3: wanted: {"node":">=12.22.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
11:40:16 PM: npm WARN notsup Not compatible with your version of node/npm: react-hook-form#7.39.3
11:40:16 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.3.2 (node_modules/chokidar/node_modules/fsevents):
11:40:16 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:40:16 PM: npm WARN notsup Unsupported engine for type-fest#2.19.0: wanted: {"node":">=12.20"} (current: {"node":"12.18.0","npm":"6.14.4"})
11:40:16 PM: npm WARN notsup Not compatible with your version of node/npm: type-fest#2.19.0
11:40:16 PM: npm WARN notsup Unsupported engine for gatsby-plugin-postcss#5.24.0: wanted: {"node":">=14.15.0"} (current: {"node":"12.18.0","npm":"6.14.4"})
11:40:16 PM: npm WARN notsup Not compatible with your version of node/npm: gatsby-plugin-postcss#5.24.0
11:40:16 PM: npm WARN bootstrap#5.2.2 requires a peer of #popperjs/core#^2.11.6 but none is installed. You must install peer dependencies yourself.
11:40:16 PM: npm WARN gatsby-plugin-typography#3.14.0 requires a peer of typography#^0.16.0 || ^1.0.0-alpha.0 but none is installed. You must install peer dependencies yourself.
11:40:16 PM: npm WARN gatsby-remark-katex#6.24.0 requires a peer of gatsby#^4.0.0-next but none is installed. You must install peer dependencies yourself.
11:40:16 PM: npm WARN gatsby-remark-katex#6.24.0 requires a peer of katex#^0.13.3 but none is installed. You must install peer dependencies yourself.
11:40:16 PM: npm WARN gatsby-remark-reading-time#1.1.0 requires a peer of gatsby#^2.0.0 but none is installed. You must install peer dependencies yourself.
11:40:16 PM: npm WARN eslint-config-react-app#6.0.0 requires a peer of babel-eslint#^10.0.0 but none is installed. You must install peer dependencies yourself.
11:40:16 PM: npm WARN tsutils#3.21.0 requires a peer of typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
11:40:16 PM: npm WARN ts-node#9.1.1 requires a peer of typescript#>=2.7 but none is installed. You must install peer dependencies yourself.
11:40:16 PM: npm WARN acorn-import-assertions#1.8.0 requires a peer of acorn#^8 but none is installed. You must install peer dependencies yourself.
11:40:16 PM: npm WARN gatsby-plugin-postcss#5.24.0 requires a peer of gatsby#^4.0.0-next but none is installed. You must install peer dependencies yourself.
11:40:16 PM: added 2214 packages from 1135 contributors and audited 2219 packages in 831.887s
11:40:17 PM: 363 packages are looking for funding
11:40:17 PM: run `npm fund` for details
11:40:17 PM: found 38 vulnerabilities (16 moderate, 16 high, 6 critical)
11:40:17 PM: run `npm audit fix` to fix them, or `npm audit` for details
11:40:17 PM: NPM modules installed
11:40:17 PM: Creating package sha
11:40:17 PM: Started restoring cached go cache
11:40:17 PM: Finished restoring cached go cache
11:40:17 PM: Installing Go version 1.14.4 (requested 1.14.4)
11:40:21 PM: unset GOOS;
11:40:21 PM: unset GOARCH;
11:40:21 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.14.4.linux.amd64';
11:40:21 PM: export PATH="/opt/buildhome/.gimme/versions/go1.14.4.linux.amd64/bin:${PATH}";
11:40:21 PM: go version >&2;
11:40:21 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.14.4.linux.amd64.env"
11:40:21 PM: go version go1.14.4 linux/amd64
11:40:21 PM: Detected 1 framework(s)
11:40:21 PM: "gatsby" at version "3.14.6"
11:40:21 PM: Installing missing commands
11:40:21 PM: Verify run directory
11:40:23 PM:
11:40:23 PM: ────────────────────────────────────────────────────────────────
11:40:23 PM: Netlify Build
11:40:23 PM: ────────────────────────────────────────────────────────────────
11:40:23 PM:
11:40:23 PM: ❯ Version
11:40:23 PM: #netlify/build 28.1.13
11:40:23 PM:
11:40:23 PM: ❯ Flags
11:40:23 PM: baseRelDir: true
11:40:23 PM: buildId: 63712fb964e5d200085e449c
11:40:23 PM: deployId: 63712fb964e5d200085e449e
11:40:23 PM:
11:40:23 PM: ❯ Current directory
11:40:23 PM: /opt/build/repo
11:40:23 PM:
11:40:23 PM: ❯ Config file
11:40:23 PM: No config file was defined: using default values.
11:40:23 PM:
11:40:23 PM: ❯ Context
11:40:23 PM: production
11:40:23 PM:
11:40:23 PM: ────────────────────────────────────────────────────────────────
11:40:23 PM: 1. Build command from Netlify app
11:40:23 PM: ────────────────────────────────────────────────────────────────
11:40:23 PM:
11:40:23 PM: $ npm run build
11:40:23 PM: > gatsby-starter-hello-world#0.1.0 build /opt/build/repo
11:40:23 PM: > gatsby build
11:40:24 PM: warning Plugin gatsby-plugin-postcss is not compatible with your gatsby version 3.14.6 - It requires gatsby#^4.0.0-next
11:40:25 PM: warning Plugin gatsby-remark-reading-time is not compatible with your gatsby version 3.14.6 - It requires gatsby#^2.0.0
11:40:25 PM: warning Plugin gatsby-plugin-postcss is not compatible with your gatsby version 3.14.6 - It requires gatsby#^4.0.0-next
11:40:25 PM: warning Plugin gatsby-remark-reading-time is not compatible with your gatsby version 3.14.6 - It requires gatsby#^2.0.0
11:40:25 PM: success open and validate gatsby-configs, load plugins - 0.580s
11:40:25 PM: success onPreInit - 0.002s
11:40:25 PM: success initialize cache - 0.031s
11:40:25 PM: success copy gatsby files - 0.034s
11:40:25 PM: success Compiling Gatsby Functions - 0.159s
11:40:25 PM: success onPreBootstrap - 0.166s
11:40:26 PM: success createSchemaCustomization - 0.411s
11:40:34 PM: success Checking for changed pages - 0.000s
11:40:34 PM: success source and transform nodes - 8.299s
11:40:35 PM: success building schema - 0.396s
11:40:35 PM: success createPages - 0.158s
11:40:35 PM: success createPagesStatefully - 0.064s
11:40:35 PM: info Total nodes: 2699, SitePage nodes: 541 (use --verbose for breakdown)
11:40:35 PM: success Checking for changed pages - 0.000s
11:40:35 PM: success update schema - 0.099s
11:40:35 PM: success onPreExtractQueries - 0.000s
11:40:35 PM: success extract queries from components - 0.305s
11:40:35 PM: success write out redirect data - 0.000s
11:40:35 PM: success onPostBootstrap - 0.000s
11:40:35 PM: info bootstrap finished - 12.272s
11:40:35 PM: success run static queries - 0.003s - 1/1 324.33/s
11:41:40 PM: success run page queries - 64.400s - 541/541 8.40/s
11:41:40 PM: success write out requires - 0.007s
11:41:56 PM: success Building production JavaScript and CSS bundles - 16.351s
11:41:56 PM: success Rewriting compilation hashes - 0.048s
11:41:56 PM: success Writing page-data.json files to public directory - 0.440s - 541/541 1229.54/s
11:42:01 PM: success Building HTML renderer - 2.486s
11:42:02 PM: error Page data from page-data.json for the failed page "/review-January-2022/": {
11:42:02 PM: "componentChunkName": "component---src-templates-blog-post-js",
11:42:02 PM: "path": "/review-January-2022/",
11:42:02 PM: "result": {
11:42:02 PM: "data": {
11:42:02 PM: "markdownRemark": {
11:42:02 PM: "html": "<p>In January, I achieved my target of writing 10 blog posts.</p>\n<p>My original plan was to build a developer blog using Gatsby. Even though I started following the tutorial on the official Gatsby site, I veered off course. I practiced a little b...",
11:42:02 PM: "frontmatter": {
11:42:02 PM: "title": "Review - January, 2022",
11:42:02 PM: "date": "2022-02-01"
11:42:02 PM: }
11:42:02 PM: }
11:42:02 PM: },
11:42:02 PM: "pageContext": {
11:42:02 PM: "slug": "/review-January-2022/",
11:42:02 PM: "prev": {
11:42:02 PM: "fields": {
11:42:02 PM: "slug": "/define-python-functions-with-unlimited-keyword-arguments-using-kwargs/"
11:42:02 PM: },
11:42:02 PM: "frontmatter": {
11:42:02 PM: "modules": null
11:42:02 PM: }
11:42:02 PM: },
11:42:02 PM: "next": {
11:42:02 PM: "fields": {
11:42:02 PM: "slug": "/check-the-type-of-a-python-variable/"
11:42:02 PM: },
11:42:02 PM: "frontmatter": {
11:42:02 PM: "modules": null
11:42:02 PM: }
11:42:02 PM: }
11:42:02 PM: }
11:42:02 PM: },
11:42:02 PM: "staticQueryHashes": [
11:42:02 PM: "3159585216"
11:42:02 PM: ]
11:42:02 PM: }
11:42:02 PM: failed Building static HTML for pages - 1.409s
11:42:02 PM: error Building static HTML failed for path "/review-January-2022/"
11:42:02 PM:
11:42:02 PM: 100 | }
11:42:02 PM: 101 |
11:42:02 PM: > 102 | return merge(a, b, { arrayMerge: combineMerge })
11:42:02 PM: | ^
11:42:02 PM: 103 | }
11:42:02 PM: 104 |
11:42:02 PM: 105 | export default async function staticPage({
11:42:02 PM:
11:42:02 PM: WebpackError: TypeError: merge is not a function (from plugin: gatsby-plugin-r eact-helmet)
11:42:02 PM:
11:42:02 PM: - static-entry.js:102
11:42:02 PM: gatsby-starter-hello-world/.cache/static-entry.js:102:10
11:42:02 PM:
11:42:02 PM: - static-entry.js:166
11:42:02 PM: gatsby-starter-hello-world/.cache/static-entry.js:166:24
11:42:02 PM:
11:42:02 PM: - gatsby-ssr.js:17
11:42:02 PM: [gatsby-starter-hello-world]/[gatsby-plugin-react-helmet]/gatsby-ssr.js:17:5
11:42:02 PM: - api-runner-ssr.js:52
11:42:02 PM: gatsby-starter-hello-world/.cache/api-runner-ssr.js:52:22
11:42:02 PM:
11:42:02 PM: - api-runner-ssr.js:45
11:42:02 PM: gatsby-starter-hello-world/.cache/api-runner-ssr.js:45:11
11:42:02 PM:
11:42:02 PM: - static-entry.js:307
11:42:02 PM: gatsby-starter-hello-world/.cache/static-entry.js:307:5
11:42:02 PM:
11:42:02 PM: - index.es.js:121
11:42:02 PM: [gatsby-starter-hello-world]/[#fortawesome]/free-solid-svg-icons/index.es.js :121:1
11:42:02 PM:
11:42:02 PM:
11:42:02 PM: not finished Caching JavaScript and CSS webpack compilation - 6.127s
11:42:02 PM: not finished Caching HTML renderer compilation - 1.518s
11:42:02 PM: npm ERR! code ELIFECYCLE
11:42:02 PM: npm ERR! errno 1
11:42:02 PM: npm ERR! gatsby-starter-hello-world#0.1.0 build: `gatsby build`
11:42:02 PM: npm ERR! Exit status 1
11:42:02 PM: npm ERR!
11:42:02 PM: npm ERR! Failed at the gatsby-starter-hello-world#0.1.0 build script.
11:42:02 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
11:42:02 PM: npm ERR! A complete log of this run can be found in:
11:42:02 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-11-13T18_12_02_730Z-debug.log
11:42:02 PM:
11:42:02 PM: ────────────────────────────────────────────────────────────────
11:42:02 PM: "build.command" failed
11:42:02 PM: ────────────────────────────────────────────────────────────────
11:42:02 PM:
11:42:02 PM: Error message
11:42:02 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
11:42:02 PM:
11:42:02 PM: Error location
11:42:02 PM: In Build command from Netlify app:
11:42:02 PM: npm run build
11:42:02 PM:
11:42:02 PM: Resolved config
11:42:02 PM: build:
11:42:02 PM: command: npm run build
11:42:02 PM: commandOrigin: ui
11:42:02 PM: publish: /opt/build/repo/public
11:42:02 PM: publishOrigin: ui
11:42:03 PM: Caching artifacts
11:42:03 PM: Started saving node modules
11:42:03 PM: Finished saving node modules
11:42:03 PM: Started saving build plugins
11:42:03 PM: Finished saving build plugins
11:42:03 PM: Started saving pip cache
11:42:03 PM: Finished saving pip cache
11:42:03 PM: Started saving emacs cask dependencies
11:42:03 PM: Finished saving emacs cask dependencies
11:42:03 PM: Started saving maven dependencies
11:42:03 PM: Finished saving maven dependencies
11:42:03 PM: Started saving boot dependencies
11:42:03 PM: Finished saving boot dependencies
11:42:03 PM: Started saving rust rustup cache
11:42:03 PM: Finished saving rust rustup cache
11:42:03 PM: Started saving go dependencies
11:42:03 PM: Finished saving go dependencies
11:42:08 PM: Cached ruby version 2.7.1
11:42:08 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:42:08 PM: Creating deploy upload records
11:42:08 PM: Failing build: Failed to build site
11:42:08 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
11:42:08 PM: Finished processing build request in 15m58.036179676s
What do I need to do to fix this error?
Found this on GitHub:
"Another temporary solution is adding explicitely deepmerge dependency to your project."
Hope it helps.
https://github.com/gatsbyjs/gatsby/issues/33274
When I run the build on Netlify it fails, but when I run it on my local windows pc it runs like a charm
This is is the Netlify output (The error occurs when Netlify runs the build comand):
10:32:27 PM: Build ready to start
10:32:29 PM: build-image version: 3031d4c9e432fd7016f6279fc9ad706f9205d845
10:32:29 PM: build-image tag: v3.3.17
10:32:29 PM: buildbot version: 1f35b3abd6e2bf5230d8edf68072840fdec1513f
10:32:29 PM: Fetching cached dependencies
10:32:30 PM: Failed to fetch cache, continuing with build
10:32:30 PM: Starting to prepare the repo for build
10:32:30 PM: No cached dependencies found. Cloning fresh repo
10:32:30 PM: git clone https://github.com/ChristofferHennie/api-webapp-easyapi
10:32:31 PM: Preparing Git Reference refs/heads/master
10:32:32 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
10:32:32 PM: Starting build script
10:32:32 PM: Installing dependencies
10:32:32 PM: Python version set to 2.7
10:32:34 PM: v12.18.0 is already installed.
10:32:34 PM: Now using node v12.18.0 (npm v6.14.4)
10:32:34 PM: Started restoring cached build plugins
10:32:35 PM: Finished restoring cached build plugins
10:32:35 PM: Attempting ruby version 2.7.1, read from environment
10:32:36 PM: Using ruby version 2.7.1
10:32:36 PM: Using PHP version 5.6
10:32:36 PM: 5.2 is already installed.
10:32:36 PM: Using Swift version 5.2
10:32:36 PM: Started restoring cached node modules
10:32:36 PM: Finished restoring cached node modules
10:32:37 PM: Installing NPM modules using NPM version 6.14.4
10:33:09 PM: > core-js#2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
10:33:09 PM: > node -e "try{require('./postinstall')}catch(e){}"
10:33:09 PM: > core-js#3.6.5 postinstall /opt/build/repo/node_modules/core-js
10:33:09 PM: > node -e "try{require('./postinstall')}catch(e){}"
10:33:09 PM: > core-js-pure#3.6.5 postinstall /opt/build/repo/node_modules/core-js-pure
10:33:09 PM: > node -e "try{require('./postinstall')}catch(e){}"
10:33:11 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
10:33:11 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:33:11 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
10:33:11 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:33:11 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
10:33:11 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:33:11 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/fsevents):
10:33:11 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:33:11 PM: added 1679 packages from 795 contributors and audited 1683 packages in 33.786s
10:33:13 PM: 59 packages are looking for funding
10:33:13 PM: run `npm fund` for details
10:33:13 PM: found 1 low severity vulnerability
10:33:13 PM: run `npm audit fix` to fix them, or `npm audit` for details
10:33:13 PM: NPM modules installed
10:33:13 PM: Started restoring cached go cache
10:33:13 PM: Finished restoring cached go cache
10:33:13 PM: go version go1.14.4 linux/amd64
10:33:13 PM: go version go1.14.4 linux/amd64
10:33:13 PM: Installing missing commands
10:33:13 PM: Verify run directory
10:33:15 PM:
10:33:15 PM: ┌─────────────────────────────┐
10:33:15 PM: │ Netlify Build │
10:33:15 PM: └─────────────────────────────┘
10:33:15 PM:
10:33:15 PM: ❯ Version
10:33:15 PM: #netlify/build 2.0.10
10:33:15 PM:
10:33:15 PM: ❯ Flags
10:33:15 PM: deployId: 5ef266db8af236000856f030
10:33:15 PM: mode: buildbot
10:33:15 PM:
10:33:15 PM: ❯ Current directory
10:33:15 PM: /opt/build/repo
10:33:15 PM:
10:33:15 PM: ❯ Config file
10:33:15 PM: No config file was defined: using default values.
10:33:15 PM:
10:33:15 PM: ❯ Context
10:33:15 PM: production
10:33:15 PM:
10:33:15 PM: ┌────────────────────────────────┐
10:33:15 PM: │ 1. Build command from settings │
10:33:15 PM: └────────────────────────────────┘
10:33:15 PM:
10:33:15 PM: $ npm run build
10:33:15 PM: > api-webapi-easyapi#0.1.0 build /opt/build/repo
10:33:15 PM: > react-scripts build
10:33:16 PM: Creating an optimized production build...
10:33:19 PM: Failed to compile.
10:33:19 PM:
10:33:19 PM: ./src/App.js
10:33:19 PM: Cannot find file './components/pages/About' in './src'.
10:33:19 PM: npm ERR! code ELIFECYCLE
10:33:19 PM: npm ERR! errno 1
10:33:19 PM: npm ERR! api-webapi-easyapi#0.1.0 build: `react-scripts build`
10:33:19 PM: npm ERR! Exit status 1
10:33:19 PM: npm ERR!
10:33:19 PM: npm ERR! Failed at the api-webapi-easyapi#0.1.0 build script.
10:33:19 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:33:19 PM: npm ERR! A complete log of this run can be found in:
10:33:19 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-06-23T20_33_19_677Z-debug.log
10:33:19 PM:
10:33:19 PM: ┌─────────────────────────────┐
10:33:19 PM: │ "build.command" failed │
10:33:19 PM: └─────────────────────────────┘
10:33:19 PM:
10:33:19 PM: Error message
10:33:19 PM: Command failed with exit code 1: npm run build
10:33:19 PM:
10:33:19 PM: Error location
10:33:19 PM: In Build command from settings:
10:33:19 PM: npm run build
10:33:19 PM:
10:33:19 PM: Resolved config
10:33:19 PM: build:
10:33:19 PM: command: npm run build
10:33:19 PM: publish: /opt/build/repo/build
10:33:19 PM: Caching artifacts
10:33:19 PM: Started saving node modules
10:33:19 PM: Finished saving node modules
10:33:19 PM: Started saving build plugins
10:33:19 PM: Finished saving build plugins
10:33:19 PM: Started saving pip cache
10:33:27 PM: Finished saving pip cache
10:33:27 PM: Started saving emacs cask dependencies
10:33:27 PM: Finished saving emacs cask dependencies
10:33:27 PM: Started saving maven dependencies
10:33:27 PM: Finished saving maven dependencies
10:33:27 PM: Started saving boot dependencies
10:33:27 PM: Finished saving boot dependencies
10:33:27 PM: Started saving go dependencies
10:33:27 PM: Finished saving go dependencies
10:33:30 PM: Error running command: Build script returned non-zero exit code: 1
10:33:30 PM: Failing build: Failed to build site
10:33:30 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
10:33:30 PM: Finished processing build request in 1m0.370032766s
It says that there is an import error in the app.js on line 4 but I can't find it. To my eyes, it is as it should be.
import React, { useState } from 'react'
import { BrowserRouter as Router, Route } from "react-router-dom"
import Header from "./components/Header"
import About from "./components/pages/About"
import GetData from "./components/GetData"
import DisplayData from "./components/DisplayData";
import Payload from "./components/Payload"
import "./App.css"
const App = () => {
const [data, setData] = useState({})
const [payload, setPayload] = useState({})
return (
<Router>
<Header/>
<Route exact path="/" render={props => (
<div className="home">
<GetData setData={setData} payload={payload}/>
<div className="main">
<Payload setPayload={setPayload} payload={payload}/>
<DisplayData data={data}/>
</div>
</div>
)}/>
<Route path="/about" component={About}/>
</Router>
)
}
export default App;
The file it points to is just a simple placeholder:
import React from 'react';
const About = () => {
return (
<div>
<h1>About</h1>
</div>
);
};
export default About;
In advance thanks for any help!
Update #1
I found the flaw. An error occurred so GitHub didn't register that the page directory changes name from "Pages" to "pages"
Just eyeballing the log it doesn't seem like there's anything wrong with the code in the file, it's complaining that it can't find the file at all. Exactly why will depend on your build setup, but my first guess is that you either haven't checked components/pages/About in or haven't pushed to your repo since checking it in.
This question suggests you can download a build or (cat a list of files from the build) to investigate that guess.
As i see, you don't have a "pages" directory inside "components" directory
10:33:19 PM: ./src/App.js
10:33:19 PM: Cannot find file './components/pages/About' in './src'.
So you have to change :
import About from "./components/pages/About"
To (depending on what you have in your repo):
import About from "./components/Pages/About"
Pretty new to useing Next JS and combined information from various tutorials, but stuck on what I am doing wrong with either file structure or the build process in general in order to have a successful deployment to Netlify.
In the nextjs tutorial they have you put pages in /pages directory at the root. But most tutorials with webpack have you put them in another directory, the /src. well for now I don't need to worry about webpack and just want to deploy the site.
Followed this tutorial https://medium.com/#azizhk/next-js-netlify-c246ea070ae2
in my package.json i have
"scripts": {
"dev": "next",
"build": "next build && next export",
"start": "serve ./out"
},
My Build Settings in Netlify
Where the build went wrong
6:32:04 PM: Error running command: Build script returned non-zero exit code: 127
6:32:04 PM: Failing build: Failed to build site
6:32:04 PM: failed during stage 'building site': Build script returned non-zero exit code: 127
Updated directory structure
Full notes of errors from build
6:31:16 PM: Build ready to start
6:31:30 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
6:31:30 PM: build-image tag: v3.3.2
6:31:30 PM: buildbot version: 8727aab446158e7b8c8ad2e96fe74b0154505a4e
6:31:30 PM: Fetching cached dependencies
6:31:31 PM: Starting to download cache of 2.0MB
6:31:31 PM: Finished downloading cache in 158.159923ms
6:31:31 PM: Starting to extract cache
6:31:31 PM: Finished extracting cache in 24.261695ms
6:31:31 PM: Finished fetching cache in 184.056316ms
6:31:31 PM: Starting to prepare the repo for build
6:31:31 PM: Preparing Git Reference refs/heads/master
6:31:32 PM: Starting build script
6:31:32 PM: Installing dependencies
6:31:33 PM: Downloading and installing node v10.16.3...
6:31:34 PM: Downloading https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz...
6:31:34 PM:
######################
6:31:34 PM: 31.2%
6:31:34 PM:
##################################################################
6:31:34 PM: 92.1%
6:31:34 PM:
########################################################################
6:31:34 PM: 100.0%
6:31:34 PM: Computing checksum with sha256sum
6:31:34 PM: Checksums matched!
6:31:38 PM: Now using node v10.16.3 (npm v6.9.0)
6:31:38 PM: Attempting ruby version 2.6.2, read from environment
6:31:39 PM: Using ruby version 2.6.2
6:31:39 PM: Using PHP version 5.6
6:31:39 PM: Started restoring cached node modules
6:31:39 PM: Finished restoring cached node modules
6:31:40 PM: Installing NPM modules using NPM version 6.9.0
6:31:59 PM: > core-js#2.6.10 postinstall /opt/build/repo/node_modules/core-js
6:31:59 PM: > node postinstall || echo "ignore"
6:31:59 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
6:31:59 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
6:31:59 PM: > https://opencollective.com/core-js
6:31:59 PM: > https://www.patreon.com/zloirock
6:31:59 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
6:31:59 PM: > styled-components#4.4.0 postinstall /opt/build/repo/node_modules/styled-components
6:31:59 PM: > node ./scripts/postinstall.js || exit 0
6:31:59 PM: Use styled-components at work? Consider supporting our development efforts at https://opencollective.com/styled-components
6:32:00 PM: npm WARN
6:32:00 PM: cityguide#1.0.0 No description
6:32:00 PM: npm WARN cityguide#1.0.0 No repository field.
6:32:00 PM: npm
6:32:00 PM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/fsevents):
6:32:00 PM: npm WARN
6:32:00 PM: notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6:32:00 PM: added 1014 packages from 493 contributors and audited 19416 packages in 19.734s
6:32:00 PM: found 0 vulnerabilities
6:32:00 PM: NPM modules installed
6:32:01 PM: Started restoring cached go cache
6:32:01 PM: Finished restoring cached go cache
6:32:01 PM: unset GOOS;
6:32:01 PM: unset GOARCH;
6:32:01 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
6:32:01 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
6:32:01 PM: go version >&2;
6:32:01 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
6:32:01 PM: go version go1.12 linux/amd64
6:32:01 PM: Installing missing commands
6:32:01 PM: Verify run directory
6:32:01 PM: Executing user command: yarn build
6:32:01 PM: /usr/local/bin/build: line 60: yarn: command not found
6:32:01 PM: Skipping functions preparation step: no functions directory set
6:32:01 PM: Caching artifacts
6:32:01 PM: Started saving node modules
6:32:01 PM: Finished saving node modules
6:32:01 PM: Started saving pip cache
6:32:01 PM: Finished saving pip cache
6:32:01 PM: Started saving emacs cask dependencies
6:32:01 PM: Finished saving emacs cask dependencies
6:32:01 PM: Started saving maven dependencies
6:32:01 PM: Finished saving maven dependencies
6:32:01 PM: Started saving boot dependencies
6:32:01 PM: Finished saving boot dependencies
6:32:01 PM: Started saving go dependencies
6:32:01 PM: Finished saving go dependencies
6:32:04 PM: Error running command: Build script returned non-zero exit code: 127
6:32:04 PM: Failing build: Failed to build site
6:32:04 PM: failed during stage 'building site': Build script returned non-zero exit code: 127
6:32:04 PM: Finished processing build request in 33.478673773s
You can use below script to deploy your app in netlify
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"export": "next export",
"deploy": "yarn run build && yarn run export"
},
Here are netlify build settings.
If you are using npm then please write npm instead of yarn.
I have a website deployed on Netlify through GitHub and after committing few changes Netlify fails in deploying the current build.
I do not get any errors from running 'npm run build' or running the code locally.
The website is build with create-react-app.
The main changes from the previous commits would be the addition of the assets(images) to the whole project.
I did double check every import and is everything fine.
...
5:15:52 PM: Installing NPM modules using NPM version 6.9.0
5:16:05 PM: npm
5:16:05 PM: WARN #typescript-eslint/eslint-plugin#1.6.0 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
5:16:05 PM: npm
5:16:05 PM: WARN #typescript-eslint/parser#1.6.0 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
5:16:05 PM: npm
5:16:05 PM: WARN #typescript-eslint/typescript-estree#1.6.0 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
5:16:05 PM: npm WARN
5:16:05 PM: ts-pnp#1.1.2 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
5:16:05 PM: npm
5:16:05 PM: WARN tsutils#3.14.0 requires a peer of typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev but none is installed. You must install peer dependencies yourself.
5:16:05 PM: npm
5:16:05 PM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/jest-haste-map/node_modules/fsevents):
5:16:05 PM: npm WARN
5:16:05 PM: notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:16:05 PM: npm
5:16:05 PM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/chokidar/node_modules/fsevents):
5:16:05 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:16:05 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.0.6 (node_modules/fsevents):
5:16:05 PM: npm
5:16:05 PM: WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.0.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
5:16:05 PM: audited 902137 packages in 12.338s
5:16:05 PM: found 0 vulnerabilities
5:16:05 PM: NPM modules installed
5:16:06 PM: Started restoring cached go cache
5:16:06 PM: Finished restoring cached go cache
5:16:06 PM: unset GOOS;
5:16:06 PM: unset GOARCH;
5:16:06 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
5:16:06 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
5:16:06 PM: go version >&2;
5:16:06 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
5:16:06 PM: go version go1.12 linux/amd64
5:16:06 PM: Installing missing commands
5:16:06 PM: Verify run directory
5:16:06 PM: Executing user command: npm run build
5:16:07 PM: > geek-hard-level#0.1.0 build /opt/build/repo
5:16:07 PM: > react-scripts build
5:16:09 PM: Creating an optimized production build...
5:16:14 PM: Failed to compile.
5:16:14 PM: ./src/components/footer/footer.js
5:16:14 PM: Cannot find file '../../assets/images/Logo.jpg' in './src/components/footer'.
5:16:14 PM: npm
5:16:14 PM: ERR! code ELIFECYCLE
5:16:14 PM: npm
5:16:14 PM: ERR! errno 1
5:16:14 PM: npm
5:16:14 PM: ERR! geek-hard-level#0.1.0 build: `react-scripts build`
5:16:14 PM: npm
5:16:14 PM: ERR!
5:16:14 PM: Exit status 1
5:16:14 PM: npm
5:16:14 PM: ERR!
5:16:14 PM: npm ERR!
5:16:14 PM: Failed at the geek-hard-level#0.1.0 build script.
5:16:14 PM: npm
5:16:14 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
5:16:14 PM: ERR! This is probably not a problem with npm. There is likely additional logging output above.
5:16:14 PM: npm
5:16:14 PM: ERR! A complete log of this run can be found in:
5:16:14 PM: npm ERR! /opt/buildhome/.npm/_logs/2019-07-14T16_16_14_542Z-debug.log
5:16:14 PM: Skipping functions preparation step: no functions directory set
5:16:14 PM: Caching artifacts
5:16:14 PM: Started saving node modules
5:16:14 PM: Finished saving node modules
5:16:14 PM: Started saving pip cache
5:16:14 PM: Finished saving pip cache
5:16:14 PM: Started saving emacs cask dependencies
5:16:14 PM: Finished saving emacs cask dependencies
5:16:14 PM: Started saving maven dependencies
5:16:14 PM: Finished saving maven dependencies
5:16:14 PM: Started saving boot dependencies
5:16:14 PM: Finished saving boot dependencies
5:16:14 PM: Started saving go dependencies
5:16:14 PM: Finished saving go dependencies
5:16:14 PM: Error running command: Build script returned non-zero exit code: 1
5:16:14 PM: Failing build: Failed to build site
5:16:14 PM: Finished processing build request in 36.62159852s
I expected the build to be deployed as it always has but I get an error
5:16:14 PM: Cannot find file '../../assets/images/Logo.jpg' in './src/components/footer'.```
I did check this line and it works just fine.
Edit:
Trying to re-deploy the code it throws me the same error but this time instead of being in /components/footer is in /components/contacts, where there is the same Logo.jpg file
```5:31:09 PM: ./src/components/contacts/contacts.js
5:31:09 PM: Cannot find file '../../assets/images/Logo.jpg' in './src/components/contacts'.
Move your images assets into the public folder that comes by default with React, and refine the paths that you are using such like:
import image from '../../public/images/Logo.jpg'
Sultan H. answer was partially correct.
I solved my issue by moving the images folder inside the same folder of the components. As much as I believe it is not a good practise Netlify is successful in publishing it.
If I had to move the images folder inside the public one it would throw a new error.
Having a quick look on this new error it should be something related to create-react-app which does not allow to import anything from any folder outside the src.