To run the program, we have a batch file called buildAndRun.bat that cleans Maven, then it installs Node and NPM in case they aren't already there. After this it runs ng build --configuration production
. Every step works fine up until it actually tries to build the application.
It runs ng build --configuration production
. but whenever it does, it throws an error that it cannot find the module:
M:Application Production\frontend\node_modules\@angular-devkit\core\node_modules\rxjs\dist\cjs\index.js
The issue is that within rxjs
, there is no dist
directory. So I'm not surprised at the error, I just don't know why it's not generating the dist
directory.
Here's what I have installed:
Node 18.16.1
npm 9.7.2
@angular-devkit/architect 0.1601.4
@angular-devkit/build-angular 16.1.4
@angular-devkit/core 16.1.4
@angular-devkit/schematics 16.1.5
@angular/cli 16.1.5
@angular/language-service 16.1.6
@schematics/angular 16.1.5
rxjs 6.5.5
typescript 4.9.5
zone.js 0.13.1
I've tried deleting and reinstalling @angular-devkit
, but it still won't generate the necessary files. I've also tried doing a fresh install of Node to see if that might have been the issue, but that also doesn't seem to work. It should just build the application, but as above, it just throws the Cannot find module
error. The part I don't understand is that it was working fine a week ago, and I haven't made any changes to it since then.
EDIT:
Tried what @MatthieuRiegler said, but it just resulted in the following errors:
[INFO] Error occurs in the template of component HeaderComponent.
[INFO]
[INFO]
[INFO] Error: src/app/header/header.component.html:24:79 - error NG8002: Can't bind to 'formGroup' since it isn't a known property of 'form'.
[INFO]
[INFO] 24 <form *ngIf="currentUserRole !== 'none'" class="form-inline my-2 my-lg-0" [formGroup]="searchForm" (ngSubmit)="onSubmit()">
[INFO] ~~~~~~~~~~~~~~~~~~~~~~~~
[INFO]
[INFO] src/app/header/header.component.ts:9:16
[INFO] 9 templateUrl: "./header.component.html",
[INFO] ~~~~~~~~~~~~~~~~~~~~~~~~~
[INFO] Error occurs in the template of component HeaderComponent.
[INFO]
[INFO]
[INFO] Error: src/app/home.component.html:92:89 - error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'.
[INFO]
[INFO] 92 <input type="date" id="start_date" class="date-input" name="start_date" [(ngModel)]="start_date">
[INFO] ~~~~~~~~~~~~~~~~~~~~~~~~
[INFO]
[INFO] src/app/home.component.ts:11:16
[INFO] 11 templateUrl: './home.component.html',
[INFO] ~~~~~~~~~~~~~~~~~~~~~~~
[INFO] Error occurs in the template of component HomeComponent.
[INFO]
[INFO]
[INFO] Error: src/app/home.component.html:96:85 - error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'.
[INFO]
[INFO] 96 <input type="date" id="end_date" class="date-input" name="end_date" [(ngModel)]="end_date">
[INFO] ~~~~~~~~~~~~~~~~~~~~~~
[INFO]
[INFO] src/app/home.component.ts:11:16
[INFO] 11 templateUrl: './home.component.html',
[INFO] ~~~~~~~~~~~~~~~~~~~~~~~
[INFO] Error occurs in the template of component HomeComponent.
[INFO]
[INFO]
[INFO] Error: src/app/home.component.html:103:58 - error NG8004: No pipe found with name 'date'.
[INFO]
[INFO] 103 <span class="current-date">{{ currentStart | date:'MM/dd/yyyy' }} - {{ currentEnd | date:'MM/dd/yyyy' }}</span>
[INFO] ~~~~
[INFO]
[INFO] src/app/home.component.ts:11:16
[INFO] 11 templateUrl: './home.component.html',
[INFO] ~~~~~~~~~~~~~~~~~~~~~~~
EDIT 2:
Here's my package.json as requested by @Andrei
{
"name": "angular-nodejs-example",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "16.1.7",
"@angular/common": "16.1.7",
"@angular/compiler": "16.1.7",
"@angular/core": "16.1.7",
"@angular/forms": "16.1.7",
"@angular/platform-browser": "16.1.7",
"@angular/platform-browser-dynamic": "16.1.7",
"@angular/router": "16.1.7",
"@canvasjs/angular-charts": "^1.0.3",
"@canvasjs/charts": "^3.7.12",
"@fullcalendar/angular": "^6.1.8",
"@fullcalendar/core": "^6.1.8",
"@fullcalendar/daygrid": "^6.1.8",
"@fullcalendar/timegrid": "^6.1.8",
"@ng-bootstrap/ng-bootstrap": "^15.1.0",
"@ngrx/effects": "^16.0.0",
"@ngrx/entity": "^16.0.0",
"@ngrx/router-store": "^16.0.0",
"@ngrx/store": "^16.0.0",
"@ngrx/store-devtools": "^16.0.0",
"@popperjs/core": "^2.11.8",
"angular-oauth2-oidc": "^15.0.1",
"bootstrap": "4.1.1",
"canvasjs": "^1.8.3",
"ngrx": "0.0.1-security",
"ngrx-store-freeze": "^0.2.4",
"ngrx-store-localstorage": "^16.0.0",
"rxjs": "~6.5.4",
"tslib": "^2.0.0",
"typescript": "^4.8.4",
"zone.js": "~0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "16.1.4",
"@angular/cli": "16.1.5",
"@angular/compiler-cli": "16.1.7",
"@angular/language-service": "16.1.6",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.2",
"jasmine-core": "3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.2",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0"
}
}