0

I have an angular project that works fine when it's on the server But on localHost, it automatically refreshes the browser every 30 seconds

I have not written any code to refresh the page, for example a code like window.location.reload()

I tested with browsers like chrome, firefox, edge and they have the same problem

I ran the project with commandPrompt and it still had the problem

I also ran vscode through commandPrompt itself, and it had a problem and the page was refreshing

I don't know if it has anything to do with the browser cache or not, but I also deleted it and unfortunately the problem did not go away

And finally, when refreshing, this error is printed on the console and the page is reloaded

enter image description here

And in the version of my Angular packages, it is like this

"dependencies": {
    "@angular/animations": "^12.2.16",
    "@angular/cdk": "^12.2.13",
    "@angular/common": "^12.2.16",
    "@angular/compiler": "^12.2.16",
    "@angular/core": "^12.2.16",
    "@angular/forms": "^12.2.16",
    "@angular/localize": "^12.2.16",
    "@angular/material": "^12.2.13",
    "@angular/platform-browser": "^12.2.16",
    "@angular/platform-browser-dynamic": "^12.2.16",
    "@angular/router": "^12.2.16",
    "@angular/service-worker": "^12.2.16",
    "@aspnet/signalr": "^3.0.0-preview6.19307.2",
    "@asymmetrik/ngx-leaflet": "8.1.0",
    "@circlon/angular-tree-component": "^11.0.4",
    "@formio/angular": "^5.3.0",
    "@fortawesome/angular-fontawesome": "^0.9.0",
    "@fortawesome/fontawesome-svg-core": "^6.2.0",
    "@fortawesome/free-brands-svg-icons": "^5.15.3",
    "@fortawesome/free-regular-svg-icons": "^5.15.3",
    "@fortawesome/free-solid-svg-icons": "^6.2.0",
    "@fullcalendar/angular": "^5.1.0",
    "@fullcalendar/core": "^5.1.0",
    "@fullcalendar/daygrid": "^5.1.0",
    "@fullcalendar/interaction": "^5.1.0",
    "@fullcalendar/list": "^5.1.0",
    "@fullcalendar/timegrid": "^5.1.0",
    "@iplab/ngx-color-picker": "^2.1.1",
    "@microsoft/signalr": "^5.0.5",
    "@nebular/eva-icons": "^7.0.0",
    "@nebular/theme": "7.0.0",
    "@ng-bootstrap/ng-bootstrap": "10.0.0",
    "@ngrx/effects": "^11.1.0",
    "@ngrx/store": "^11.1.0",
    "@ngx-translate/core": "^13.0.0",
    "@ngx-translate/http-loader": "^6.0.0",
    "@swimlane/ngx-charts": "^17.0.1",
    "@types/codemirror": "0.0.108",
    "ag-grid": "^18.1.2",
    "angular-gauge": "^4.0.0",
    "angular-gauge-chart": "^0.7.2",
    "angular-google-charts": "^2.2.1",
    "angular-gridster2": "^11.1.5",
    "angular-oauth2-oidc": "^12.1.0",
    "angular-responsive-carousel": "^2.1.2",
    "angular2-toaster": "^11.0.1",
    "bootstrap": "^5.1.3",
    "chart.js": "^3.9.1",
    "chartjs-plugin-datalabels": "^1.0.0",
    "chartjs-plugin-zoom": "^1.2.1",
    "classlist.js": "1.1.20150312",
    "codemirror": "^5.60.0",
    "core-js": "3.10.1",
    "eva-icons": "^1.1.3",
    "flag-icon-css": "^3.5.0",
    "font-awesome": "^4.7.0",
    "fontawesome-4.7": "^4.7.0",
    "formiojs": "^4.14.8",
    "gulp-brotli": "^3.0.0",
    "gulp-clean": "^0.4.0",
    "gulp-filter": "^7.0.0",
    "gulp-gzip": "^1.4.2",
    "gulp-purify-css": "^0.1.0",
    "gulp-rename": "^2.0.0",
    "html-to-image": "^1.11.11",
    "html-to-pdfmake": "^2.4.16",
    "html-webpack-plugin": "^5.5.0",
    "intro.js": "^6.0.0",
    "jalali-moment": "^3.3.11",
    "jquery": "^3.6.0",
    "jqwidgets-ng": "^12.0.4",
    "jspdf": "^2.5.1",
    "leaflet": "1.7.1",
    "linq": "^3.2.3",
    "lodash": "^4.17.21",
    "material-jalali-moment-adapter": "^4.0.0",
    "moment-duration-format": "^2.3.2",
    "moment-jalaali": "^0.9.6",
    "ng-multiselect-dropdown": "^0.3.4",
    "ng-zorro-antd": "^11.4.2",
    "ng2-dnd": "^5.0.2",
    "ng2-jalali-date-picker": "^2.4.2",
    "ng2-tooltip-directive": "~2.9.22",
    "ngx-bootstrap": "^6.2.0",
    "ngx-color": "^7.3.3",
    "ngx-color-picker": "^11.0.0",
    "ngx-filesize": "^2.0.16",
    "ngx-infinite-scroll": "^6.9.1",
    "ngx-loading": "^8.0.0",
    "ngx-material-timepicker": "^5.5.3",
    "ngx-permissions": "^8.1.1",
    "ngx-persian": "^1.3.2",
    "ngx-sortablejs": "^11.1.0",
    "ngx-spinner": "^12.0.0",
    "ngx-toastr": "^13.2.1",
    "ngx-ui-switch": "^11.0.1",
    "npm": "^7.9.0",
    "pdfmake": "^0.2.7",
    "primeflex": "^3.2.1",
    "primeicons": "^5.0.0",
    "primeng": "^12.2.3",
    "quill": "^1.3.7",
    "rxjs": "^6.6.7",
    "rxjs-compat": "^6.6.7",
    "sortablejs": "^1.13.0",
    "sweetalert2": "^10.16.2",
    "swiper": "^6.8.4",
    "tslib": "^2.2.0",
    "web-animations-js": "^2.3.2",
    "webpack": "^4.44.2",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^12.2.18",
    "@angular/cli": "^12.2.18",
    "@angular/compiler-cli": "^12.2.16",
    "@biesbjerg/ngx-translate-extract": "^7.0.4",
    "@compodoc/compodoc": "^1.1.19",
    "@types/intro.js": "^5.1.0",
    "@types/lodash": "^4.14.184",
    "@types/node": "^14.14.39",
    "autoprefixer": "^10.4.7",
    "conventional-changelog-cli": "2.1.1",
    "gulp": "^4.0.2",
    "gulp-util": "^3.0.8",
    "gulp-zip": "^5.1.0",
    "jasmine-core": "~3.7.1",
    "jasmine-spec-reporter": "~7.0.0",
    "json-server": "^0.17.1",
    "karma": "^6.3.17",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~4.0.1",
    "karma-jasmine-html-reporter": "^1.5.4",
    "postcss": "^8.4.14",
    "protractor": "~7.0.0",
    "rimraf": "3.0.2",
    "stylelint": "13.12.0",
    "ts-node": "^9.1.1",
    "tslint": "~6.1.0",
    "typescript": "~4.3.5"
  }

I feel that my problem is with the browser itself because I ran another project with localhost:4200 and the problem was the same.

davood beheshti
  • 213
  • 1
  • 11
  • 2
    Does your browser reload Stack Overflow every 30 seconds? – Pointy Aug 26 '23 at 13:27
  • 2
    Read those error messages. Something ("WDS"?) is performing some kind of "automatic reload". What exactly that means, I can't say. Also you should probably fix that script `import` error. – Pointy Aug 26 '23 at 13:30
  • No, I did not ask such a question When I run the project on localhost, my browser automatically refreshes every 30 seconds – davood beheshti Aug 26 '23 at 13:30
  • 3
    My point is that the problem is not your browser. Your application is doing it somehow. – Pointy Aug 26 '23 at 13:31
  • I don't know what exactly wds does Is it related to the network? – davood beheshti Aug 26 '23 at 13:33
  • we don't know either, but it's in your project, perhaps as a dependency. If you click on the `index.js` link next to the "live reloading enabled" message in the console you'll see what is printing that message, in which file, and presumably get some context from that that you can look at in your project's files. – Robin Zigmond Aug 26 '23 at 13:42
  • a quick google suggests it might be "webpack dev server", and [this question](https://stackoverflow.com/questions/41797704/how-to-disable-webpack-dev-server-auto-reload) may be relevant – Robin Zigmond Aug 26 '23 at 13:44

1 Answers1

0

Run your project with this command

ng serve --live-reload=false