Solvedangular cli Issue during update existing project on Angular 11 to version 12

Bug Report

Issue

During execution of:

ng update @angular/core@12 @angular/cli@12

Get an exception:

An unhandled exception occurred: The "path" argument must be of type string. Received undefined
See "C:\Users\YX5870~1.DON\AppData\Local\Temp\ng-0ukmwd\angular-errors.log" for further details.

The context of file:

[error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:124:11)
    at Object.resolve (path.js:154:9)
    at isInside (C:\Program Files (x86)\nodejs\node_modules\@angular\cli\utilities\config.js:192:35)
    at C:\Program Files (x86)\nodejs\node_modules\@angular\cli\utilities\config.js:202:28
    at Array.filter ()
    at findProjectByPath (C:\Program Files (x86)\nodejs\node_modules\@angular\cli\utilities\config.js:202:10)
    at getProjectByCwd (C:\Program Files (x86)\nodejs\node_modules\@angular\cli\utilities\config.js:231:21)
    at Object.getConfiguredPackageManager (C:\Program Files (x86)\nodejs\node_modules\@angular\cli\utilities\config.js:256:25)
    at async Object.getPackageManager (C:\Program Files (x86)\nodejs\node_modules\@angular\cli\utilities\package-manager.js:35:27)
    at async UpdateCommand.initialize (C:\Program Files (x86)\nodejs\node_modules\@angular\cli\commands\update-impl.js:46:31)

Environment

Angular version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.0.0
Node: 14.17.0
Package Manager: 
OS: win32 ia32

Angular: 
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.0 (cli-only)
@angular-devkit/build-angular   
@angular-devkit/core            12.0.0 (cli-only)
@angular-devkit/schematics      12.0.0 (cli-only)
@angular/cli                    12.0.0 (cli-only)
@schematics/angular             12.0.0 (cli-only)
rxjs                            6.6.7 (cli-only)
typescript                      

package.json

{
  "name": "Res",
  "version": "3.1.20",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "increase-version": "node ./build/version-increment.js",
    "post-build": "node ./build/post-build.js",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/schematics": "^11.1.0",
    "@angular/animations": "11.1.0",
    "@angular/cdk": "^11.1.0",
    "@angular/common": "~11.1.0",
    "@angular/compiler": "11.1.0",
    "@angular/core": "11.1.0",
    "@angular/forms": "11.1.0",
    "@angular/localize": "^11.1.0",
    "@angular/platform-browser": "11.1.0",
    "@angular/platform-browser-dynamic": "11.1.0",
    "@angular/router": "11.1.0",
    "@angularclass/hmr": "^3.0.0",
    "@ng-bootstrap/ng-bootstrap": "^9.0.1",
    "@ng-select/ng-select": "5.1.0",
    "@ngx-progressbar/core": "^5.3.2",
    "@ngx-progressbar/http": "^5.3.2",
    "@ngx-progressbar/router": "^5.3.2",
    "angular-in-memory-web-api": "0.11.0",
    "angular-oauth2-oidc": "10.0.3",
    "bootstrap": "4.6.0",
    "bootstrap-select": "1.13.18",
    "core-js": "3.8.3",
    "hammerjs": "2.0.8",
    "jquery": "3.5.1",
    "jwt-decode": "3.1.2",
    "lodash-es": "^4.17.20",
    "ng-multiselect-dropdown": "^0.2.14",
    "ngx-scrollbar": "^7.5.3",
    "ngx-toastr": "13.2.0",
    "popper.js": "1.16.1",
    "rxjs": "6.6.3",
    "ts-debug": "1.3.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1101.0",
    "@angular-eslint/builder": "1.1.0",
    "@angular-eslint/eslint-plugin": "1.1.0",
    "@angular-eslint/eslint-plugin-template": "1.1.0",
    "@angular-eslint/schematics": "1.1.0",
    "@angular-eslint/template-parser": "1.1.0",
    "@angular/cli": "^11.1.0",
    "@angular/compiler-cli": "11.1.0",
    "@angular/language-service": "11.1.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/jwt-decode": "^3.1.0",
    "@types/node": "^14.14.22",
    "@typescript-eslint/eslint-plugin": "4.3.0",
    "@typescript-eslint/eslint-plugin-tslint": "^4.14.1",
    "@typescript-eslint/parser": "4.3.0",
    "codelyzer": "^6.0.0",
    "eslint": "^7.6.0",
    "eslint-plugin-deprecation": "^1.2.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "iframe-resizer": "^4.3.1",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~6.0.0",
    "karma": "~6.0.1",
    "karma-chrome-launcher": "~3.1.0",
    "karma-cli": "~2.0.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": "~9.1.1",
    "typescript": "~4.1.3"
  }
}
17 Answers

✔️Accepted Answer

Can you try to update your global cli?

npm i @angular/cli -g

Other Answers:

@alan-agius4

I had the same problem trying to update from 12.0.0.0 to 12.0.0.1 just now.
Didn't have a problem last week updating from latest 11 to 12.0.0.0.
Your suggestion to updating the global cli fixed it for me.

I am getting the same error as well. Note, I wasn't getting this error on Saturday last week when I upgraded another project.

ng update @angular/core@12 @angular/cli@12
The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
 Package successfully installed.
An unhandled exception occurred: Cannot locate bin for temporary package: @angular/cli.

log

[error] Error: Cannot locate bin for temporary package: @angular/cli.
    at Object.runTempPackageBin (C:\Users\a\AppData\Roaming\npm\node_modules\@angular\cli\utilities\install-package.js:116:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async UpdateCommand.validateAndRun (C:\Users\a\AppData\Roaming\npm\node_modules\@angular\cli\models\command.js:136:22)
    at async Object.runCommand (C:\Users\a\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js:205:24)
    at async default_1 (C:\Users\a\AppData\Roaming\npm\node_modules\@angular\cli\lib\cli\index.js:70:31)

More Issues: