NPM error when deploying react app to netlify - reactjs

I'm trying to deploy my website to netlify, I keep getting this error
9:59:45 PM: npm ERR! npm ERR! code EINVALIDTAGNAME
9:59:45 PM: npm ERR! npm ERR! Invalid tag name "^>= 4": Tags may not have any characters that encodeURIComponent encodes.
This is the complete failed deploy log on netlify
9:58:10 PM: Build ready to start
9:58:12 PM: build-image version: 3bcb38c35508b42e9121d4badfe6d8c66fd7a3f0
9:58:12 PM: build-image tag: v4.3.2
9:58:12 PM: buildbot version: 5f1a3c6e77d89b95b77370734ae1aecf3a51e9c1
9:58:12 PM: Fetching cached dependencies
9:58:12 PM: Failed to fetch cache, continuing with build
9:58:12 PM: Starting to prepare the repo for build
9:58:12 PM: No cached dependencies found. Cloning fresh repo
9:58:12 PM: git clone https://github.com/Abudibro/sneaker-select
9:58:20 PM: Preparing Git Reference refs/heads/main
9:58:22 PM: Parsing package.json dependencies
9:58:22 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
9:58:22 PM: Starting build script
9:58:22 PM: Installing dependencies
9:58:22 PM: Python version set to 2.7
9:58:23 PM: Downloading and installing node v16.12.0...
9:58:23 PM: Downloading https://nodejs.org/dist/v16.12.0/node-v16.12.0-linux-x64.tar.xz...
9:58:23 PM: Computing checksum with sha256sum
9:58:23 PM: Checksums matched!
9:58:26 PM: Now using node v16.12.0 (npm v8.1.0)
9:58:26 PM: Started restoring cached build plugins
9:58:26 PM: Finished restoring cached build plugins
9:58:26 PM: Attempting ruby version 2.7.2, read from environment
9:58:28 PM: Using ruby version 2.7.2
9:58:28 PM: Using PHP version 8.0
9:58:28 PM: Started restoring cached node modules
9:58:29 PM: Finished restoring cached node modules
9:58:29 PM: Installing NPM modules using NPM version 8.1.0
9:58:31 PM: npm WARN old lockfile
9:58:31 PM: npm WARN old lockfile The package-lock.json file was created with an old version of npm,
9:58:31 PM: npm WARN old lockfile so supplemental metadata must be fetched from the registry.
9:58:31 PM: npm WARN old lockfile
9:58:31 PM: npm WARN old lockfile This is a one-time fix-up, please be patient...
9:58:31 PM: npm WARN old lockfile
9:58:56 PM: npm WARN old lockfile Error: git dep preparation failed
9:58:56 PM: npm WARN old lockfile at ChildProcess.<anonymous> (/opt/buildhome/.nvm/versions/node/v16.12.0/lib/node_modules/npm/node_modules/#npmcli/promise-spawn/index.js:64:27)
9:58:56 PM: npm WARN old lockfile at ChildProcess.emit (node:events:390:28)
9:58:56 PM: npm WARN old lockfile at maybeClose (node:internal/child_process:1064:16)
9:58:56 PM: npm WARN old lockfile at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
9:58:56 PM: npm WARN old lockfile Could not fetch metadata for hero-slider#git+ssh://git#github.com/Abudibro/hero-slider.git#f13601fe5cb15b0a1c2f35f246d9342f4f3012e8 Error: git dep preparation failed
9:58:56 PM: npm WARN old lockfile at ChildProcess.<anonymous> (/opt/buildhome/.nvm/versions/node/v16.12.0/lib/node_modules/npm/node_modules/#npmcli/promise-spawn/index.js:64:27)
9:58:56 PM: npm WARN old lockfile at ChildProcess.emit (node:events:390:28)
9:58:56 PM: npm WARN old lockfile at maybeClose (node:internal/child_process:1064:16)
9:58:56 PM: npm WARN old lockfile at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
9:58:56 PM: npm WARN old lockfile cmd: '/opt/buildhome/.nvm/versions/node/v16.12.0/bin/node',
9:58:56 PM: npm WARN old lockfile args: [
9:58:56 PM: npm WARN old lockfile '/opt/buildhome/.nvm/versions/node/v16.12.0/lib/node_modules/npm/bin/npm-cli.js',
9:58:56 PM: npm WARN old lockfile 'install',
9:58:56 PM: npm WARN old lockfile '--force',
9:58:56 PM: npm WARN old lockfile '--cache=/opt/buildhome/.npm',
9:58:56 PM: npm WARN old lockfile '--prefer-offline=false',
9:58:56 PM: npm WARN old lockfile '--prefer-online=false',
9:58:56 PM: npm WARN old lockfile '--offline=false',
9:58:56 PM: npm WARN old lockfile '--no-progress',
9:58:56 PM: npm WARN old lockfile '--no-save',
9:58:56 PM: npm WARN old lockfile '--no-audit',
9:58:56 PM: npm WARN old lockfile '--include=dev',
9:58:56 PM: npm WARN old lockfile '--include=peer',
9:58:56 PM: npm WARN old lockfile '--include=optional',
9:58:56 PM: npm WARN old lockfile '--no-package-lock-only',
9:58:56 PM: npm WARN old lockfile '--no-dry-run'
9:58:56 PM: npm WARN old lockfile ],
9:58:56 PM: npm WARN old lockfile code: 1,
9:58:56 PM: npm WARN old lockfile signal: null,
9:58:56 PM: npm WARN old lockfile stdout: '',
9:58:56 PM: npm WARN old lockfile stderr: 'npm WARN using --force Recommended protections disabled.\n' +
9:58:56 PM: npm WARN old lockfile 'npm WARN old lockfile \n' +
9:58:56 PM: npm WARN old lockfile 'npm WARN old lockfile The package-lock.json file was created with an old version of npm,\n' +
9:58:56 PM: npm WARN old lockfile 'npm WARN old lockfile so supplemental metadata must be fetched from the registry.\n' +
9:58:56 PM: npm WARN old lockfile 'npm WARN old lockfile \n' +
9:58:56 PM: npm WARN old lockfile 'npm WARN old lockfile This is a one-time fix-up, please be patient...\n' +
9:58:56 PM: npm WARN old lockfile 'npm WARN old lockfile \n' +
9:58:56 PM: npm WARN old lockfile 'npm ERR! code EINVALIDTAGNAME\n' +
9:58:56 PM: npm WARN old lockfile 'npm ERR! Invalid tag name "^>= 4": Tags may not have any characters that encodeURIComponent encodes.\n' +
9:58:56 PM: npm WARN old lockfile '\n' +
9:58:56 PM: npm WARN old lockfile 'npm ERR! A complete log of this run can be found in:\n' +
9:58:56 PM: npm WARN old lockfile 'npm ERR! /opt/buildhome/.npm/_logs/2021-10-25T20_58_56_298Z-debug.log\n'
9:58:56 PM: npm WARN old lockfile }
9:59:08 PM: npm WARN deprecated flatten#1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
9:59:09 PM: npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
9:59:09 PM: npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
9:59:10 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.
9:59:10 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.
9:59:12 PM: npm WARN deprecated sane#4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
9:59:12 PM: npm WARN deprecated querystring#0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
9:59:13 PM: npm WARN deprecated rollup-plugin-babel#4.4.0: This package has been deprecated and is no longer maintained. Please use #rollup/plugin-babel.
9:59:20 PM: npm WARN deprecated babel-eslint#10.1.0: babel-eslint is now #babel/eslint-parser. This package will no longer receive updates.
9:59:21 PM: npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
9:59:21 PM: npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
9:59:22 PM: npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
9:59:23 PM: npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
9:59:23 PM: npm WARN deprecated svgo#1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
9:59:23 PM: npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
9:59:24 PM: npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
9:59:24 PM: npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
9:59:25 PM: npm WARN deprecated #hapi/joi#15.1.1: Switch to 'npm install joi'
9:59:31 PM: npm WARN deprecated core-js#2.6.12: core-js#<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
9:59:45 PM: npm ERR! code 1
9:59:45 PM: npm ERR! git dep preparation failed
9:59:45 PM: npm ERR! command /opt/buildhome/.nvm/versions/node/v16.12.0/bin/node /opt/buildhome/.nvm/versions/node/v16.12.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/opt/buildhome/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
9:59:45 PM: npm ERR! npm WARN using --force Recommended protections disabled.
9:59:45 PM: npm ERR! npm WARN old lockfile
9:59:45 PM: npm ERR! npm WARN old lockfile The package-lock.json file was created with an old version of npm,
9:59:45 PM: npm ERR! npm WARN old lockfile so supplemental metadata must be fetched from the registry.
9:59:45 PM: npm ERR! npm WARN old lockfile
9:59:45 PM: npm ERR! npm WARN old lockfile This is a one-time fix-up, please be patient...
9:59:45 PM: npm ERR! npm WARN old lockfile
9:59:45 PM: npm ERR! npm ERR! code EINVALIDTAGNAME
9:59:45 PM: npm ERR! npm ERR! Invalid tag name "^>= 4": Tags may not have any characters that encodeURIComponent encodes.
9:59:45 PM: npm ERR!
9:59:45 PM: npm ERR! npm ERR! A complete log of this run can be found in:
9:59:45 PM: npm ERR! npm ERR! /opt/buildhome/.npm/_logs/2021-10-25T20_59_41_917Z-debug.log
9:59:45 PM: npm ERR! A complete log of this run can be found in:
9:59:45 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-10-25T20_59_45_083Z-debug.log
9:59:45 PM: Error during NPM install
9:59:45 PM: Build was terminated: Build script returned non-zero exit code: 1
9:59:45 PM: Creating deploy upload records
9:59:45 PM: Failing build: Failed to build site
9:59:45 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
9:59:45 PM: Finished processing build request in 1m33.030553565s
I've tried deleting my package-lock.json, I've also tried deleting my node_modules folder and running
npm install
I've also tried putting CI= in my deploy command
Nothing I've tried works. If you could help, that would be greatly appreciated
Nothing has worked

The issue comes from your dependency "hero-slider", which in turn specifies a peer dependency of the package styled-components as follow:
"peerDependencies": {
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"styled-components": "^>= 4"
},
Since you have control over the hero-slider package.json, modify that line and you should be good to go. Edit for clarity: that is, replace it with a specific tag version of the package styled-components, for example "4.3.1".
Alternatively, since your fork of the hero-slider does not seem to add any new feature (besides removing few JS logs), you may link to the hero-slider package from the npm registry. Unless you want to make future commits to your github fork, without publishing it on npm.

Related

Netlify Build Crashing On Installing Material UI

I am trying to deploy my react application on netlify. It is working fine on my desktop and even npm run build is properly working. The material ui packages that I am using are also working fine on my desktop but when I am deploying on netlify the build fails. This is the error log
12:16:02 PM: No npm workspaces detected
12:16:02 PM: Started restoring cached node modules
12:16:02 PM: Finished restoring cached node modules
12:16:02 PM: Installing NPM modules using NPM version 8.19.2
12:16:04 PM: npm ERR! code ERESOLVE
12:16:04 PM: npm ERR! ERESOLVE could not resolve
12:16:04 PM: npm ERR!
12:16:04 PM: Creating deploy upload records
12:16:04 PM: npm ERR! While resolving: #material-ui/core#4.12.4
12:16:04 PM: npm ERR! Found: react#18.2.0
12:16:04 PM: npm ERR! node_modules/react
12:16:04 PM: npm ERR! react#"^18.2.0" from the root project
12:16:04 PM: npm ERR! peer react#">=16.8.0" from #emotion/react#11.10.5
12:16:04 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
12:16:04 PM: npm ERR! node_modules/#emotion/react
12:16:04 PM: npm ERR! #emotion/react#"^11.10.5" from the root project
12:16:04 PM: npm ERR! peer #emotion/react#"^11.0.0-rc.0" from #emotion/styled#11.10.5
12:16:04 PM: npm ERR! node_modules/#emotion/styled
12:16:04 PM: npm ERR! #emotion/styled#"^11.10.5" from the root project
12:16:04 PM: npm ERR! 3 more (#mui/material, #mui/styled-engine, #mui/system)
12:16:04 PM: npm ERR! 3 more (#mui/material, #mui/styled-engine, #mui/system)
12:16:04 PM: npm ERR! 16 more (#emotion/styled, ...)
12:16:04 PM: npm ERR!
12:16:04 PM: npm ERR! Could not resolve dependency:
12:16:04 PM: npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
12:16:04 PM: npm ERR! node_modules/#material-ui/core
12:16:04 PM: npm ERR! #material-ui/core#"^4.12.4" from the root project
12:16:04 PM: npm ERR!
12:16:04 PM: npm ERR! Conflicting peer dependency: react#17.0.2
12:16:04 PM: npm ERR! node_modules/react
12:16:04 PM: npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
12:16:04 PM: npm ERR! node_modules/#material-ui/core
12:16:04 PM: npm ERR! #material-ui/core#"^4.12.4" from the root project
12:16:04 PM: npm ERR!
12:16:04 PM: npm ERR! Fix the upstream dependency conflict, or retry
12:16:04 PM: npm ERR! this command with --force, or --legacy-peer-deps
12:16:04 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
12:16:04 PM: npm ERR!
12:16:04 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
12:16:04 PM: npm ERR! A complete log of this run can be found in:
12:16:04 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-12-04T06_46_03_020Z-debug-0.log
12:16:04 PM: Error during NPM install
12:16:04 PM: Build was terminated: Build script returned non-zero exit code: 1
12:16:04 PM: Failing build: Failed to build site
12:16:04 PM: Finished processing build request in 5.438038347s```
I think this is something related to package versions and there might be some conflict
you are using react 18 but #material-ui/core requires react 16 or 17
so can downgrade your react or upgrade material-ui to version 5
or add --force to ignore the conflict of packages
npm i #material-ui/core --force

react-google-login npm package error in version of react#"^18.2.0" from the root project

I'm getting error in react-google-login npm package here i've shown build code
10:50:18 AM: Build ready to start
10:50:21 AM: build-image version: 72a309a113b53ef075815b129953617827965e48 (focal)
10:50:21 AM: build-image tag: v4.8.2
10:50:21 AM: buildbot version: 515e5c33287d8b909c004fcf2e460e8645e8c1c6
10:50:21 AM: Fetching cached dependencies
10:50:21 AM: Failed to fetch cache, continuing with build
10:50:21 AM: Starting to prepare the repo for build
10:50:21 AM: No cached dependencies found. Cloning fresh repo
10:50:21 AM: git clone https://github.com/abhidadhaniya23/xlinks-client
10:50:22 AM: Preparing Git Reference refs/heads/master
10:50:22 AM: Parsing package.json dependencies
10:50:23 AM: Starting build script
10:50:23 AM: Installing dependencies
10:50:23 AM: Python version set to 2.7
10:50:24 AM: v16.15.1 is already installed.
10:50:25 AM: Now using node v16.15.1 (npm v8.11.0)
10:50:25 AM: Started restoring cached build plugins
10:50:25 AM: Finished restoring cached build plugins
10:50:25 AM: Attempting ruby version 2.7.2, read from environment
10:50:26 AM: Using ruby version 2.7.2
10:50:26 AM: Using PHP version 8.0
10:50:27 AM: No npm workspaces detected
10:50:27 AM: Started restoring cached node modules
10:50:27 AM: Finished restoring cached node modules
10:50:27 AM: Installing NPM modules using NPM version 8.11.0
10:50:27 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:50:27 AM: npm WARN config location in the cache, and they are managed by
10:50:27 AM: npm WARN config [`cacache`](http://npm.im/cacache).
10:50:28 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:50:28 AM: npm WARN config location in the cache, and they are managed by
10:50:28 AM: npm WARN config [`cacache`](http://npm.im/cacache).
10:50:30 AM: npm ERR! code ERESOLVE
10:50:30 AM: npm ERR! ERESOLVE could not resolve
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! While resolving: react-google-login#5.2.2
10:50:30 AM: Creating deploy upload records
10:50:30 AM: npm ERR! Found: react#18.2.0
10:50:30 AM: npm ERR! node_modules/react
10:50:30 AM: npm ERR! react#"^18.2.0" from the root project
10:50:30 AM: npm ERR! peer react#"^18.0.0" from #testing-library/react#13.3.0
10:50:30 AM: npm ERR! node_modules/#testing-library/react
10:50:30 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
10:50:30 AM: npm ERR! #testing-library/react#"^13.3.0" from the root project
10:50:30 AM: npm ERR! 2 more (react-dom, react-scripts)
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! Could not resolve dependency:
10:50:30 AM: npm ERR! peer react#"^16 || ^17" from react-google-login#5.2.2
10:50:30 AM: npm ERR! node_modules/react-google-login
10:50:30 AM: npm ERR! react-google-login#"^5.2.2" from the root project
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! Conflicting peer dependency: react#17.0.2
10:50:30 AM: npm ERR! node_modules/react
10:50:30 AM: npm ERR! peer react#"^16 || ^17" from react-google-login#5.2.2
10:50:30 AM: npm ERR! node_modules/react-google-login
10:50:30 AM: npm ERR! react-google-login#"^5.2.2" from the root project
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! Fix the upstream dependency conflict, or retry
10:50:30 AM: npm ERR! this command with --force, or --legacy-peer-deps
10:50:30 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
10:50:30 AM: npm ERR! A complete log of this run can be found in:
10:50:30 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-07-01T05_20_28_238Z-debug-0.log
10:50:30 AM: Error during NPM install
10:50:30 AM: Build was terminated: Build script returned non-zero exit code: 1
10:50:30 AM: Failing build: Failed to build site
10:50:30 AM: Finished processing build request in 9.18683257s
I've also tried npm install react-google-login --legacy-peer-deps command to install react-google-login but still build failed in netlify building process.
This log, I've atteched from netlify build.
When I install packages using npm install it shows 6 high severity vulnerabilities

React app deployment error Error during NPM install

This is the error:
12:28:55 PM: Installing NPM modules using NPM version 8.11.0
12:28:56 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:28:56 PM: npm WARN config location in the cache, and they are managed by
12:28:56 PM: npm WARN config [`cacache`](http://npm.im/cacache).
12:28:56 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:28:56 PM: npm WARN config location in the cache, and they are managed by
12:28:56 PM: npm WARN config [`cacache`](http://npm.im/cacache).
12:28:57 PM: npm ERR! code ERESOLVE
12:28:57 PM: npm ERR! ERESOLVE could not resolve
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! While resolving: react-alert#7.0.3
12:28:58 PM: Creating deploy upload records
12:28:57 PM: npm ERR! Found: react#18.2.0
12:28:57 PM: npm ERR! node_modules/react
12:28:57 PM: npm ERR! react#"^18.2.0" from the root project
12:28:57 PM: npm ERR! peer react#"^18.0.0" from #testing-library/react#13.0.1
12:28:57 PM: npm ERR! node_modules/#testing-library/react
12:28:58 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
12:28:57 PM: npm ERR! #testing-library/react#"^13.0.1" from the root project
12:28:57 PM: npm ERR! 5 more (react-dom, react-router, react-router-dom, ...)
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! Could not resolve dependency:
12:28:57 PM: npm ERR! peer react#"^16.8.1 || ^17" from react-alert#7.0.3
12:28:57 PM: npm ERR! node_modules/react-alert
12:28:57 PM: npm ERR! react-alert#"^7.0.3" from the root project
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! Conflicting peer dependency: react#17.0.2
12:28:57 PM: npm ERR! node_modules/react
12:28:57 PM: npm ERR! peer react#"^16.8.1 || ^17" from react-alert#7.0.3
12:28:57 PM: npm ERR! node_modules/react-alert
12:28:57 PM: npm ERR! react-alert#"^7.0.3" from the root project
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! Fix the upstream dependency conflict, or retry
12:28:57 PM: npm ERR! this command with --force, or --legacy-peer-deps
12:28:57 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
12:28:57 PM: npm ERR! A complete log of this run can be found in:
12:28:57 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-06-25T06_58_56_560Z-debug-0.log
12:28:57 PM: Error during NPM install
12:28:57 PM: Build was terminated: Build script returned non-zero exit code: 1
12:28:58 PM: Failing build: Failed to build site
12:28:58 PM: Finished processing build request in 8.110559255s
I trying to debugging it by Updating node modules but the error can't be solved
This problem is happening due to the version conflicts. So try the below command to install all dependencies properly,
npm install --legacy-peer-deps
It means that your React version (18) is not compatible with react-alert React version (16.8.1 or 17). https://www.npmjs.com/package/react-alert#user-content-peer-dependencies
So my propose is: If this package is necessary, so I recommend to downgrade your React version to 17 or 16.8.1 and test it in your local environment, before deploy. If this does not work, so remove your node_modules folder and install all packages again.

Error deploying build on netlify (err: 1)

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.

Can not deploy gatsby site to Netlify with fontawesome pro

I have a static site built with Gatstbyjs + contentful. When I try to build and deploy it through Netlify, I encounter some weird problems.
After examing my code, I still couldn't find a fix for it. Build works perfectly fine locally, and it seems like the problem only exists when I try to build it through Netlify. I'm guessing this has to do with the FontAwesome Pro plugin needs an access token in order to be accessed through NPM on Netlify? I have the plugin configured with the access token locally on my machine, but not sure how to do it with Netlify. Does this mean I have to remove this plugin altogether?
Here is the error log:
11:21:33 PM: Build ready to start
11:21:36 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
11:21:36 PM: build-image tag: v3.3.2
11:21:36 PM: buildbot version: ef8d0929ed0baabafd8bbb7d0b021e1fc24180c0
11:21:36 PM: Fetching cached dependencies
11:21:36 PM: Starting to download cache of 255.0KB
11:21:36 PM: Finished downloading cache in 86.678513ms
11:21:36 PM: Starting to extract cache
11:21:36 PM: Failed to fetch cache, continuing with build
11:21:36 PM: Starting to prepare the repo for build
11:21:37 PM: No cached dependencies found. Cloning fresh repo
11:21:37 PM: git clone https://github.com/sniperyork/theconcord
11:21:39 PM: Preparing Git Reference refs/heads/master
11:21:39 PM: Starting build script
11:21:39 PM: Installing dependencies
11:21:41 PM: Downloading and installing node v10.16.0...
11:21:41 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
11:21:41 PM:
#################
11:21:41 PM: 23.9%
11:21:42 PM:
####################################################################
11:21:42 PM: #### 100.0%
11:21:42 PM: Computing checksum with sha256sum
11:21:42 PM: Checksums matched!
11:21:44 PM: Now using node v10.16.0 (npm v6.9.0)
11:21:45 PM: Attempting ruby version 2.6.2, read from environment
11:21:46 PM: Using ruby version 2.6.2
11:21:46 PM: Using PHP version 5.6
11:21:46 PM: Started restoring cached node modules
11:21:46 PM: Finished restoring cached node modules
11:21:47 PM: Installing NPM modules using NPM version 6.9.0
11:21:50 PM: npm
11:21:50 PM: WARN deprecated #babel/polyfill#7.4.4: 🚨 As of Babel 7.4.0, this
11:21:50 PM: npm WARN deprecated package has been deprecated in favor of directly
11:21:50 PM: npm WARN deprecated including core-js/stable (to polyfill ECMAScript
11:21:50 PM: npm WARN deprecated features) and regenerator-runtime/runtime
11:21:50 PM: npm WARN deprecated (needed to use transpiled generator functions):
11:21:50 PM: npm WARN deprecated
11:21:50 PM: npm WARN deprecated > import "core-js/stable";
11:21:50 PM: npm
11:21:50 PM: WARN deprecated > import "regenerator-runtime/runtime";
11:21:56 PM: npm WARN deprecated joi#11.4.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
11:22:00 PM: npm WARN deprecated topo#2.0.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
11:22:00 PM: npm WARN deprecated hoek#4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
11:22:01 PM: npm WARN deprecated core-js#1.2.7: core-js#<2.6.8 is no longer maintained. Please, upgrade to core-js#3 or at least to actual version of core-js#2.
11:22:08 PM: npm ERR! code E404
11:22:08 PM: npm ERR!
11:22:08 PM: 404 Not Found - GET https://registry.npmjs.org/#fortawesome%2fpro-light-svg-icons - Not found
11:22:08 PM: npm ERR!
11:22:08 PM: 404
11:22:08 PM: npm
11:22:08 PM: ERR! 404 '#fortawesome/pro-light-svg-icons#^5.9.0' is not in the npm registry.
11:22:08 PM: npm ERR!
11:22:08 PM: 404 You should bug the author to publish it (or use the name yourself!)
11:22:08 PM: npm
11:22:08 PM: ERR! 404 It was specified as a dependency of 'repo'
11:22:08 PM: npm ERR!
11:22:08 PM: 404
11:22:08 PM: npm ERR!
11:22:08 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:22:08 PM: 404 Note that you can also install from a
11:22:08 PM: npm ERR!
11:22:08 PM: 404 tarball, folder, http url, or git url.
11:22:08 PM: npm
From the docs you should create a .npmrc file in the root of your project (or where you have your package.json file) containing:
#fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=TOKEN
then install the latest version of the pro library using yarn or npm.
Then you import them in app.js as usual and you should be good to go.

Resources