I have an angular and nodeJs app that I am running on Heroku. Everything was running and building fine until suddenly heroku build kept failing and gave a minimal error message which made it hard to find where the issue lies. I have searched everywhere and only found one possible thread with the same issue but no fixes worked. The weird thing is that the project runs perfectly when running locally.
Another thing I noticed is that if I try to build code that was already built successfully before, I still get the same error. Can someone help and point me in the right direction to determine the cause of this error and a possible fix?
The Error I am running into is:
- Generating browser application bundles...
✔ Browser application bundle generation complete.
Warning: ./src/app/shared/item-options-dialog-component-square/item-options-dialog-component-square.component.scss
Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
Warning
(128:3) autoprefixer: end value has mixed support, consider using flex-end instead
Warning: /tmp/build_a00f8c33/src/app/order/items-by-category/items-by-category.component.scss exceeded maximum budget. Budget 7.00 kB was not met by 82 bytes with a total of 7.08 kB.
Error: node_modules/engine.io-parser/build/esm/index.d.ts:5:38 - error TS2307: Cannot find module 'node:stream/web' or its corresponding type declarations.
5 import type { TransformStream } from "node:stream/web";
~~~~~~~~~~~~~~~~~
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
A similar question I found that is similar but no answers seemed to help is: error TS2304: Cannot find name 'TransformStream'
My apckage.json is:
{
"name": "app",
"version": "2.0.0",
"browser": {
"fs": false,
"path": false,
"os": false
},
"scripts": {
"ng": "ng",
"main": "server.js",
"heroku-postbuild": "ng build --aot --configuration=${ENV}",
"preinstall": "npm install --location=global @angular/cli @angular/compiler-cli --legacy-peer-deps",
"start": "ng serve",
"cypress:open": "cypress open",
"swagger": "node ./swagger.js",
"cypress:run": "cypress run",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular-devkit/build-angular": "^0.1102.19",
"@angular/animations": "^11.0.6",
"@angular/cdk": "^11.0.6",
"@angular/cli": "^11.2.19",
"@angular/common": "^11.0.6",
"@angular/compiler": "^11.0.6",
"@angular/compiler-cli": "^11.2.14",
"@angular/core": "^11.0.6",
"@angular/flex-layout": "^11.0.0-beta.33",
"@angular/forms": "^11.0.6",
"@angular/language-service": "^11.0.6",
"@angular/localize": "^11.0.6",
"@angular/material": "^11.0.6",
"@angular/platform-browser": "^11.0.6",
"@angular/platform-browser-dynamic": "^11.0.6",
"@angular/router": "^11.0.6",
"@ng-bootstrap/ng-bootstrap": "9.0.2",
"@ngtools/webpack": "^11.2.19",
"@ngx-translate/core": "13.0.0",
"@ngx-translate/http-loader": "^4.0.0",
"@types/chart.js": "^2.7.42",
"@types/chartist": "^0.9.38",
"@types/crypto-js": "^3.1.47",
"@types/express": "^4.17.0",
"@types/jasmine": "~2.8.22",
"@types/jasminewd2": "~2.0.3",
"@types/lodash": "4.14.135",
"@types/node": "^11.15.54",
"@types/socket.io": "^3.0.2",
"@types/socket.io-client": "^3.0.0",
"@types/uuid": "^8.3.0",
"@types/w3c-web-usb": "^1.0.10",
"@types/web-bluetooth": "0.0.4",
"angular-bootstrap-md": "^11.1.0",
"angular-cc-library": "^2.1.2",
"angular-cli-ghpages": "^0.6.2",
"angular-notifier": "^9.1.0",
"angular-responsive-carousel": "^2.0.2",
"angularx-qrcode": "^11.0.0",
"apexcharts": "^3.44.0",
"axios": "^1.6.1",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"bootstrap": "^4.5.3",
"chart.js": "^2.9.4",
"chartist": "^0.11.4",
"clover-ecomm-sdk": "^1.0.0",
"config": "^3.3.6",
"core-js": "^2.5.4",
"cors": "^2.8.5",
"crypto": "^1.0.1",
"crypto-js": "^4.2.0",
"dotenv": "^6.1.0",
"exec": "^0.2.1",
"express": "^4.18.1",
"express-jwt": "^8.4.1",
"font-awesome": "^4.7.0",
"fontawesome": "^5.6.3",
"fs": "^0.0.1-security",
"got": "^11.8.1",
"hammerjs": "^2.0.8",
"jsonwebtoken": "^9.0.2",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"lz-string": "^1.5.0",
"material-dashboard": "^2.1.0",
"material-design-icons": "^3.0.1",
"material-design-lite": "^1.3.0",
"mdbootstrap": "^4.19.2",
"mongodb": "^3.0.10",
"mongoose": "^5.11.15",
"mongoose-to-swagger": "^1.5.1",
"ng-apexcharts": "1.5.12",
"ng-chartist": "^4.1.0",
"ng-multiselect-dropdown": "^0.2.14",
"ng-socket-io": "^0.2.4",
"ngx-autosize": "^1.8.4",
"ngx-bootstrap": "^6.2.0",
"ngx-device-detector": "^2.0.0",
"ngx-guided-tour": "^1.1.11",
"ngx-swiper-wrapper": "^10.0.0",
"ngx-toastr": "11.1.1",
"openai": "^4.17.4",
"path": "^0.12.7",
"popper.js": "^1.15.0",
"postcss": "^8.4.14",
"remote-pay-cloud": "4.1.1",
"remote-pay-cloud-api": "4.0.4",
"request-promise": "^4.2.4",
"resize-base64": "^1.0.12",
"rootpath": "^0.1.2",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.3.3",
"socket.io": "^4.6.2",
"socket.io-client": "^4.6.2",
"swagger-ui-express": "^5.0.0",
"time-ago-pipe": "^1.3.2",
"ts-node": "6.0.0",
"tslib": "^1.9.0",
"typescript": "4.1.6",
"uuid": "^3.3.2",
"web-animations-js": "^2.3.2",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/core": "^11.0.6",
"@angular-devkit/schematics": "^11.0.6",
"codelyzer": "^6.0.2",
"cypress": "^13.5.0",
"cypress-cucumber-preprocessor": "^4.3.1",
"cypress-multi-reporters": "^1.6.0",
"eslint-plugin-cypress": "^2.10.3",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^6.4.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ng2-charts-schematics": "^0.1.7",
"protractor": "^7.0.0",
"swagger-autogen": "^2.23.7",
"swiper": "^6.8.4",
"tslint": "~6.1.3"
},
"engines": {
"node": "18.18.2",
"npm": "9.8.1"
}
}
let me know if any other file is needed as I don't know what else to put because the error does not specify a file. I am using the socket IO service which was working fine before but the issue might be there.