Every time I launch my application, an error pops up:
The module '@angular/platform-browser/animations' cannot be found.
Here is the content of my package.json file:
{
"name": "oscar-app-ihm",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint"
},
"private": true,
"dependencies": {
"@angular/animations": "^15.0.1",
"@angular/common": "^15.0.1",
"@angular/compiler": "^15.0.1",
"@angular/core": "^15.0.1",
"@angular/forms": "^15.0.1",
"@angular/localize": "^15.0.1",
"@angular/platform-browser": "^15.0.1",
"@angular/platform-browser-dynamic": "^15.0.1",
"@angular/router": "^15.0.1",
"@popperjs/core": "^2.11.6",
"bootstrap": "^5.2.3",
"jquery": "^3.6.1",
"rxjs": "~6.5.5",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.1",
"@angular-eslint/builder": "15.0.0",
"@angular-eslint/eslint-plugin": "15.0.0",
"@angular-eslint/eslint-plugin-template": "15.0.0",
"@angular-eslint/schematics": "15.0.0",
"@angular-eslint/template-parser": "15.0.0",
"@angular/cli": "^15.0.1",
"@angular/compiler-cli": "^15.0.1",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "5.43.0",
"@typescript-eslint/parser": "5.43.0",
"eslint": "^8.28.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.1",
"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",
"typescript": "~4.8.4"
}
}
This post on Stack Overflow suggests using npm to reinstall the angular/cli.
However, running npm commands gives me this error message:
npm ERR! Unexpected token '.'
To work around this issue, I tried using Yarn to add @angular/cli and @angular/platform-browser but it did not solve the problem.
I am executing commands in the IntelliJ console from the root directory of my application.
This problem seems to have surfaced after installing Angular Material with yarn add @angular/material.
When I run yarn install to install all dependencies, it returns the following output: yarn install v1.22.5 warning package.json: No license field warning No license field [1/4] Resolving packages... success Already up-to-date.