React build fails everytime with uglify error - reactjs

I started a project using 'create-react-app' command and when I do npm run command the command is successfully run but when I use npm build command it fails with the following error everytime.
/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run build --scripts-prepend-node-path=auto
> finteen-web#0.1.0 build /home/jayg/Documents/MyCode/Code/Web/finteen-web
> react-scripts build
Creating an optimized production build...
Failed to compile.
static/js/main.626dbb4b.js from UglifyJs
SyntaxError: Unexpected token: name (length) [/home/jayg/~/punycode/punycode.js:55,0]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! finteen-web#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the finteen-web#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jayg/.npm/_logs/2019-12-13T17_52_13_422Z-debug.log
Process finished with exit code 1
With create-react-app version:0.9.5

Update your create-react-app version following the CHANGELOG.md of create react app

Related

Failed to minify the code from this file: node_modules/react-router-dom/index.js:74

This is a react project. I am getting when i try to do npm run build. Have no idea why it suddenly starts behaving this way.
I am using react-router, react-router-dom version 6.2.1 and react-scripts version 5.0.0. So not sure what's the actual issue.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abc-app build: `node dev/scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the abc-app build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

ASP.NET CORE with REACT.js npm run build code 1

When the project is trying to be deployed, I get the following Error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! s2cweb_react#0.1.0 build: react-scripts --expose-gc --max-old-space-size=8192 build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the s2cweb_react#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-09-08T13_45_58_680Z-debug.log
/home/runner/work/MyProject/MyProjectApp/MyProjectApp.csproj(36,5): error MSB3073: The command "npm run build --prod" exited with code 1.
Error: Process completed with exit code 1.
I tried to change package.json as well as MyProjectApp.csproj but no luck. I Also tried without --prod but the same error persists. Please help me.

React build failed to minify the bundle error from UglifyJs (build failed while minifying the pdfjs-dist library)

Here is an error (my project works correctly on dev, but when I try to build it, it throws me this error)
> node-react-sample#0.1.0 build /home/acquaint/WORK_DIRECTORY/altr
> node scripts/build.js
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/pdfjs-dist/build/pdf.js:341
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-react-sample#0.1.0 build: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-react-sample#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Build Failed with this error (check screenshot)

React test fail on gitlab

I am running react-scripts test --watchAll=false on gitlab ci and from time to time the test is failing without log
$ npm run test:nowatch
> app-xxx#0.1.0 test:nowatch /builds/xxx/app-xxx
> react-scripts test --watchAll=false
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app-xxx#0.1.0 test:nowatch: `react-scripts test --watchAll=false`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app-xxxs#0.1.0 test:nowatch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-02-17T09_59_37_602Z-debug.log
ERROR: Job failed: exit code 1
There are no informations in /root/.npm/_logs/2021-02-17T09_59_37_602Z-debug.log
Test are working great in local and passing the 2nd time on gitlab

Unable to deploy React App to Github Pages

After adding the home, predeploy and deploy values to package.JSON and running npm run deploy, the build folder was created successfully but the build was unable to be published.
I got this error
cloning into 'node_modules\gh-pages\.cache\github.com.okafohenry!birthday-list-keeper-react-app-.git'...
fatal: unable to access https://github.com.okafohenry/birthday-list-keeper-react-app-.git/': Could not resolve host: github.com.okafohenry
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! birthdaylistkeeper#1.0.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the birthdaylistkeeper#1.0.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I have been on this for a while now, how do I fix it?
The url seems to be wrong.
It should be https://github.com/okafohenry/birthday-list-keeper-react-app-.git/

Resources