0

I get the below error in my EC2 build box but the same is not replicable in my local

ERROR in node_modules/rxjs-compat/add/observable/dom/webSocket.d.ts(1,46): error TS2307: Cannot find module 'rxjs/websocket'.

in local I have tried

  1. ng build

  2. ng build --configuration=feature

  3. ng build --prod

    dependencies: { "@angular/animations": "^7.2.3", "@angular/cdk": "^6.4.7", "@angular/common": "^6.1.9", "@angular/compiler": "^6.1.9", "@angular/core": "^6.1.9", "@angular/flex-layout": "^6.0.0-beta.17", "@angular/forms": "^6.1.9", "@angular/http": "^6.1.9", "@angular/material": "6.4.7", "@angular/platform-browser": "^6.1.9", "@angular/platform-browser-dynamic": "^6.1.9", "@angular/router": "^6.1.9", "@briebug/jest-schematic": "^2.2.0", "@material-ui/core": "^4.9.13", "@ng-bootstrap/ng-bootstrap": "^3.3.1", "@tinymce/tinymce-angular": "3.5.0", "@types/prismjs": "^1.9.0", "ag-grid-angular": "^20.0.0", "ag-grid-community": "^20.0.0", "ajv": "^6.5.5", "angular-mentions": "^0.9.0", "angular-tag-cloud-module": "^3.8.1", "angular2-notifications": "^2.0.0", "bootstrap": "^4.4.1", "bootstrap-icons": "^1.0.0-alpha3", "chart.js": "^2.7.3", "classlist.js": "^1.1.20150312", "codelyzer": "^4.5.0", "core-js": "^2.5.7", "csurf": "^1.11.0", "express": "^4.16.3", "highcharts": "8.2.2", "highcharts-angular": "2.8.2", "jquery": "^3.5.1", "js-yaml": "^3.13.1", "lodash": "^4.17.10", "ng-bootstrap": "^1.6.3", "ng-multiselect-dropdown": "0.2.5", "ngx-cookie-service": "^2.2.0", "ngx-daterangepicker-material": "2.1.11", "ngx-infinite-scroll": "^6.0.0", "ngx-markdown": "^6.2.1", "ngx-owl-carousel": "^2.0.7", "ngx-pagination": "^5.0.0", "ngx-spinner": "^7.0.0", "ngx-toggle-switch": "^2.0.5", "owl.carousel": "^2.3.4", "popper.js": "^1.16.1", "rxjs": "6.3.3", "rxjs-compat": "6.3.3", "swagger-ui-dist": "3.25.2", "tinymce": "5.2.0", "tslint": "^5.11.0", "web-animations-js": "^2.3.1", "zone.js": "^0.8.26" }

"devDependencies": { "@angular-devkit/build-angular": "0.13.0", "@angular/cli": "^6.2.9", "@angular/compiler-cli": "^6.1.9", "@types/google.analytics": "0.0.39", "@types/jasmine": "2.5.38", "@types/jest": "latest", "@types/node": "~6.0.60", "jasmine-core": "~2.5.2", "jasmine-spec-reporter": "~3.2.0", "jest": "latest", "jest-preset-angular": "latest", "jest-sonar-reporter": "^2.0.0", "karma-cli": "~1.0.1", "prettier": "1.16.4", "protractor": "^5.3.2", "sonar-scanner": "^3.1.0", "sonarqube-scanner": "^2.8.0", "ts-node": "~2.0.0", "typescript": "~2.9.2" }

am not sure how this causing and how to replicate the same in local for better debugging. please share your thoughts

Lokesh
  • 59
  • 1
  • 11

1 Answers1

0

Check the difference between your dependencies and devDependencies. Your dev dependencies are the ones that are installed on local only for development purpose and your dependencies are the ones that goes along with the production build.

One of the fix is to install rxjs with --save flag i.e., npm install rxjs rxjs-compat --save

and another is mentioned here: https://github.com/stbui/angular-material-app/issues/39

Beshambher Chaukhwan
  • 1,418
  • 2
  • 9
  • 13
  • I tried this and it started giving different error . ERROR in node_modules/rxjs-compat/add/observable/dom/webSocket.d.ts(1,46): error TS2307: Cannot find module 'rxjs/websocket'. updated my dependencies from package.json. just wondering how to replicate these issues in my local – Lokesh Feb 16 '21 at 15:10
  • Delete node modules and Revert the package.json and swap dependencies and dev dependencies in it then redo npm install. And yes one more thing, please check the node version in your production environment. Its possible that your production infa is using old version of nodejs and npm than your local system. – Beshambher Chaukhwan Feb 16 '21 at 15:43
  • Thanks for your suggestions. But unfortunately it didnt turn out well. i tried swapping the dev and dependencies in local. it was built. also, npm and nodejs versions are identical in both local and dev build – Lokesh Feb 17 '21 at 10:17
  • Then I'm afraid we can't debug it on our end but based on the information given so far I can only conclude one thing and that is the issue is with the production environment and not the code. Because its working in your local machine with same version of node and everything but only prod deployment is having errors. – Beshambher Chaukhwan Feb 17 '21 at 11:29