Update Angular to version 16 and its dependencies specially using require keyword

868 Views Asked by At

I tried to update my Angular project from version 15 to 16 without success. After I update my packages with 'npm-check-updates' command. I get 48 moderate severity vulnerabilities. and when I call audit fix command, it doesn't do any thing. If I do 'npm audit fix --force' then it do something and I get many errors. But If I don't touch the vulnerabilities than I need to run my project.

Because I used also 'require' keyword for importing 'node-forge' and 'color-between' packages, I get an error: for using 'require' keyword. It say I should run 'npm i --save @types/node' command and in tsconfig.json I should add ' "types":["node"] ' . I already did it but still have the same error.

Any suggestion for both problems? first get ride of vulnerabilities after update and second be able to use 'require' keyword?

I will also put my package.json in this post.

{
  "name": "gui-customer",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "build:fakedb": "node ./src/assets/Mockup/jsonFiles/createdb.js ",
    "start:fakeserver": "npm run build:fakedb && node ./src/assets/Mockup/jsonFiles/fakeserver.js",
    "start:linux": "npm run start:fakeserver& ng serve",
    "start": "start npm run start:fakeserver && ng serve",
    "start:ngserver": "ng serve",
    "build": "ng build",
    "build:dev": "ng build --configuration development",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^16.1.3",
    "@angular/common": "^16.1.3",
    "@angular/compiler": "^16.1.3",
    "@angular/core": "^16.1.3",
    "@angular/forms": "^16.1.3",
    "@angular/material": "^16.1.3",
    "@angular/platform-browser": "^16.1.3",
    "@angular/platform-browser-dynamic": "^16.1.3",
    "@angular/router": "^16.1.3",
    "@ngrx/effects": "^16.0.1",
    "@ngrx/store": "^16.0.1",
    "@ngrx/store-devtools": "^16.0.1",
    "@ngx-translate/core": "^15.0.0",
    "@ngx-translate/http-loader": "^8.0.0",
    "@types/bcryptjs": "^2.4.2",
    "bcryptjs": "^2.4.3",
    "bootstrap": "^5.3.0",
    "color-between": "^1.0.2",
    "font-awesome": "^4.7.0",
    "jwt-decode": "^3.1.2",
    "ngx-toastr": "^17.0.2",
    "node-forge": "^1.3.1",
    "rxjs": "~7.8.1",
    "tslib": "^2.6.0",
    "zone.js": "~0.13.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.1.3",
    "@angular/cli": "^16.1.3",
    "@angular/compiler-cli": "^16.1.3",
    "@types/jasmine": "~4.3.5",
    "@types/node": "^20.3.2",
    "jasmine-core": "~5.0.1",
    "json-server": "^0.17.3",
    "karma": "~6.4.2",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.1",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "nodemon": "^2.0.22",
    "typescript": "~5.1.6"
  }
}
0

There are 0 best solutions below