0

Following the update guide, the process failed in updating Angular Material to version 8 using the proposed command (used also with the --force flag)

cmd /C "set "NG_DISABLE_VERSION_CHECK=1" && npx @angular/cli@8 update @angular/material@8"

I got the following message:

The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Error: This command is not available when running the Angular CLI outside a workspace.

I attach the project structure:

enter image description here

Node is of version 16.20.0 and the package angular/cli is of version 8.3.29 locally and globally. Below is my package.json file:

{
  "name": "sydep.ui",
  "version": "1.0.0",
  "description": "sydep.ui project",
  "keywords": [],
  "author": "",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "dependencies": {
    "@angular/animations": "^8.2.14",
    "@angular/cdk": "^7.1.1",
    "@angular/common": "^8.2.14",
    "@angular/compiler": "^8.2.14",
    "@angular/core": "^8.2.14",
    "@angular/forms": "^8.2.14",
    "@angular/http": "^7.1.1",
    "@angular/material": "^7.1.1",
    "@angular/platform-browser": "^8.2.14",
    "@angular/platform-browser-dynamic": "^8.2.14",
    "@angular/router": "^8.2.14",
    "@nicky-lenaers/ngx-scroll-to": "^0.6.0",
    "@types/file-saver": "^2.0.0",
    "@types/rx": "^4.1.1",
    "@types/underscore": "^1.8.3",
    "ajv": "^6.0.0",
    "b64-to-blob": "^1.2.19",
    "bootstrap": "^3.3.7",
    "core-js": "^2.6.0",
    "file-saver": "^2.0.1",
    "hammerjs": "^2.0.8",
    "jquery": "^3.2.1",
    "less": "^3.8.1",
    "less-loader": "^4.0.3",
    "material-components-web": "^0.31.0",
    "material-design-icons-iconfont": "^3.0.3",
    "material-icons": "^0.2.3",
    "ng2-file-upload": "^1.3.0",
    "ng2-validation": "^4.2.0",
    "ngx-currency-mask": "^4.3.2",
    "rxjs": "6.6.7",
    "typescript": "3.4",
    "underscore": "^1.8.3",
    "uuid": "^3.1.0",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.29",
    "@angular/cli": "^8.3.29",
    "@angular/compiler-cli": "^8.2.14",
    "@angular/language-service": "^8.2.14",
    "@types/jasmine": "^3.3.1",
    "@types/jasminewd2": "^2.0.3",
    "@types/jquery": "^3.2.5",
    "@types/node": "^10.12.12",
    "@types/protractor": "^4.0.0",
    "@types/uuid": "^3.0.0",
    "@types/webpack-env": "^1.13.5",
    "angular2-template-loader": "^0.6.0",
    "awesome-typescript-loader": "^3.0.4",
    "canonical-path": "0.0.2",
    "clean-webpack-plugin": "^0.1.16",
    "codelyzer": "^4.5.0",
    "concurrently": "^3.2.0",
    "css-loader": "^0.26.1",
    "extract-text-webpack-plugin": "2.0.0-beta.5",
    "file-loader": "^0.9.0",
    "html-loader": "^0.4.3",
    "html-webpack-plugin": "^2.16.1",
    "jasmine-core": "^3.3.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^3.1.3",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^2.0.0",
    "karma-jasmine": "^2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "lodash": "^4.17.5",
    "node-sass": "^9.0.0",
    "null-loader": "^0.1.1",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "protractor": "^5.4.1",
    "raw-loader": "^0.5.1",
    "rimraf": "^2.5.2",
    "rxjs-tslint": "^0.1.6",
    "sass-loader": "^6.0.6",
    "source-map-loader": "^0.2.4",
    "style-loader": "^0.13.1",
    "tslint": "^5.11.0",
    "webpack": "2.2.1",
    "webpack-auto-inject-version": "^1.1.0",
    "webpack-dev-server": "^3.1.10",
    "webpack-merge": "^3.0.0"
  }
}

Any suggestions would be appreciated.

UPDATED According to @Random comment I used the suggested versions:enter image description here enter image description here

but I got the following error:

[error] Error: npm ERR! Invalid dependency type requested: alias

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\tmelidis\AppData\Roaming\npm-cache\_logs\2023-06-27T14_55_25_335Z-debug.log
Package install failed, see above.
    at installPackage (C:\Users\tmelidis\AppData\Roaming\npm-cache\_npx\23616\node_modules\@angular\cli\tasks\install-package.js:37:15)
    at installTempPackage (C:\Users\tmelidis\AppData\Roaming\npm-cache\_npx\23616\node_modules\@angular\cli\tasks\install-package.js:74:5)
    at Object.runTempPackageBin (C:\Users\tmelidis\AppData\Roaming\npm-cache\_npx\23616\node_modules\@angular\cli\tasks\install-package.js:83:33)
    at UpdateCommand.run (C:\Users\tmelidis\AppData\Roaming\npm-cache\_npx\23616\node_modules\@angular\cli\commands\update-impl.js:37:38)
theomeli
  • 390
  • 4
  • 14
  • 1
    In which directory did you ran the script ? Also Angular 8 only supports Node 10. – Matthieu Riegler Jun 19 '23 at 23:06
  • Hi Matthiew and thanks for the question, I run it at the level of package.json. I downgraded my Node and I got the following error: Node.js version v10.24.1 detected. The Angular CLI requires a minimum Node.js version of either v14.20, v16.14 or v18.10. – theomeli Jun 20 '23 at 07:26
  • I have tried node v.14.21.2, v16.20.9 and v18.16.0 but I got the same message Error: This command is not available when running the Angular CLI outside a workspace. – theomeli Jun 20 '23 at 07:35
  • 2
    if angular CLI asks for a node 14+, then your version of angular cli is also too high. Check [this post](https://stackoverflow.com/a/60258560/4786273) to get which version to use – Random Jun 20 '23 at 07:51

0 Answers0