'How can i fixed the npm run deploy problem

I am trying put my new react application on github pages but I cannot resolve some things...

I'm follow the tutorial on this link "https://github.com/gitname/react-gh-pages" and when i run the command "npm run deploy", the following message appears:

[Failed to compile.

static/js/main.9e58b467.js from UglifyJs SyntaxError: Unexpected token: punc ({) [./~/react-router-dom/umd/react-router-dom.production.min.js:11,866]

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build: react-scripts build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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/arthur/.npm/_logs/2022-02-06T21_32_24_524Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] predeploy: npm run build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] predeploy script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.]1

Things that I'm already try...

  1. Install a webpack plugging with "npm install --save uglifyjs-webpack-plugin"
  2. Delete the package-lock.json, the node-modules directory and clean the npm cache, and npm install again...

Please help! I don't know what to do now...

The link to the repository is https://github.com/ArthurBMessias/react-port



Solution 1:[1]

Changing my "react-scripts" property in my package.json to version "5.0.0"

"react-scripts": "5.0.0"

worked for me!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joshua Kao