Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm run build does not update the react components

Tags:

i have a react project with the following package.json :

    {
  "name": "commonsensev2.0",
  "version": "0.1.0",
  "private": true,
  "homepage": "http://localhost:9080/server/react",
  "dependencies": {
    "all": "0.0.0",
    "axios": "^0.18.0",
    "babel-polyfill": "^6.26.0",
    "chart.js": "^2.7.3",
    "moment": "^2.23.0",
    "node-sass-chokidar": "0.0.3",
    "npm-run-all": "^4.1.5",
    "popper.js": "^1.14.6",
    "react": "^16.7.0",
    "react-bootstrap": "^0.31.5",
    "react-bootstrap-table": "^4.3.1",
    "react-chartjs2": "^1.2.1",
    "react-dom": "^16.7.0",
    "react-localize-redux": "^2.17.5",
    "react-moment": "^0.7.9",
    "react-redux": "^5.1.1",
    "react-router-dom": "^4.3.1",
    "react-scripts": "1.0.14",
    "redux": "^3.7.2"
  },
  "scripts": {
    "build-css": "node-sass-chokidar src/sass/App.scss -o src/css/",
    "watch-css": "npm run build-css && node-sass-chokidar src/sass/App.scss -o src/css/ --watch --recursive",
    "start-js": "react-scripts start",
    "start": "npm-run-all -p watch-css start-js",
    "build": "npm run build-css && react-scripts build",
    "postbuild": "((ROBOCOPY build ../react /MIR) ^& if %ERRORLEVEL% lss 8 set ERRORLEVEL = 0)",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "devDependencies": {
    "bootstrap-toggle": "^2.2.2",
    "datatables.net": "^1.10.19",
    "numeral": "^2.0.6"
  }
}

when i do npm run build i cannot see the changes on the html pages, i m using node 8.11.1 i downgraded it because i found somewhere that it maybe the reason why it does not work i'm also using "node-sass-chokidar": "0.0.3" and the backend is a java server

like image 784
hamzan Avatar asked Jan 03 '19 14:01

hamzan


People also ask

What npm run build does in react?

npm run build creates a build directory with a production build of your app. Set up your favorite HTTP server so that a visitor to your site is served index.html , and requests to static paths like /static/js/main.<hash>.js are served with the contents of the /static/js/main.<hash>.js file.

Will npm run build overwrite?

Nope, Anything you change over code, build will rerun for that change.

What is npm run build watch?

So what npm-watch actually do? npm-watch run scripts from package. json when there is any changes in your app folders or files. It's useful when you want to automate your build in server when there is any change.


1 Answers

I had the same issue, I deleted the old build folder on my local environment and ran npm run build again to generate a new build folder.

like image 72
tassmanian Avatar answered Nov 14 '22 23:11

tassmanian