Unable to install uiautomator2

I am trying to install uiautomator driver with following command:
appium driver install uiautomator2

I see the below error:

× Installing ‘uiautomator2’ using NPM install spec ‘appium-uiautomator2-driver’
Error: × Encountered an error when installing package: npm command ‘install --save-dev --omit=peer --save-exact --global-style --no-package-lock appium-uiautomator2-driver --json’ failed with code 1.
2 packages are looking for funding
STDOUT:npm fund` for details
{
“error”: {an>npm install --save-dev chromedriver
“code”: 1,
“summary”: “command failed”,
“detail”: “C:\WINDOWS\system32\cmd.exe /d /s /c node install-npm.js\ndbug ChromedriverGoogleapisStorageClient Parsed 776 entries from storage XML\ninfo ChromedriverGoogleapisStorageClient The total count of entries in the mapping: 546\ninfo ChromedriverChromelabsStorageClient The total count of entries in the mapping: 1250\ndbug ChromedriverStorageClient Selecting chromedrivers whose versions match to 117.0.5938.149\ndbug ChromedriverStorageClient Got 5 items\ndbug ChromedriverStorageClient Selecting chromedrivers whose platform matches to win:intel64\ndbug ChromedriverStorageClient Got 1 item\ndbug ChromedriverStorageClient Excluding older patches if present\ndbug ChromedriverStorageClient Versions mapping: {\ndbug ChromedriverStorageClient “117”: [\ndbug ChromedriverStorageClient “117.0.5938.149”\ndbug ChromedriverStorageClient ]\ndbug ChromedriverStorageClient }\ndbug ChromedriverStorageClient Got 1 driver to sync: [\ndbug ChromedriverStorageClient “117.0.5938.149/chromedriver-win64.zip”\ndbug ChromedriverStorageClient ]\ndbug ChromedriverStorageClient Retrieving ‘https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5938.149/win64/chromedriver-win64.zip’ to ‘C:\Users\mkhan\AppData\Local\Temp\2023911-19916-19z03tj.lr9t\0.zip’\n[10:38:32] Error installing Chromedriver: ENOTEMPTY: directory not empty, rmdir ‘C:\Users\mkhan\AppData\Local\Temp\2023911-19916-19z03tj.lr9t’\n[10:38:32] Error: ENOTEMPTY: directory not empty, rmdir ‘C:\Users\mkhan\AppData\Local\Temp\2023911-19916-19z03tj.lr9t’\n[10:38:32] Downloading Chromedriver can be skipped by setting the’APPIUM_SKIP_CHROMEDRIVER_INSTALL’ environment variable.”
}
}

STDERR:
npm WARN config global-style This option has been deprecated in favor of --install-strategy=shallow
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup [
npm WARN cleanup ‘C:\Users\mkhan\.appium\node_modules\appium’,
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir ‘C:\Users\mkhan.appium\node_modules\appium\node_modules’] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: ‘EPERM’,
npm WARN cleanup syscall: ‘rmdir’,
npm WARN cleanup path: ‘C:\Users\mkhan\.appium\node_modules\appium\node_modules’
npm WARN cleanup }
npm WARN cleanup ],
npm WARN cleanup [
npm WARN cleanup ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules\@appium\base-driver’,
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir ‘C:\Users\mkhan.appium\node_modules\appium-uiautomator2-driver\node_modules@appium\base-driver\node_modules\axios\lib’] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: ‘EPERM’,
npm WARN cleanup syscall: ‘rmdir’,
npm WARN cleanup path: ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules\@appium\base-driver\node_modules\axios\lib’
npm WARN cleanup }
npm WARN cleanup ],
npm WARN cleanup [
npm WARN cleanup ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules’,
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir ‘C:\Users\mkhan.appium\node_modules\appium-uiautomator2-driver\node_modules@appium\base-driver\node_modules\axios’] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: ‘EPERM’,
npm WARN cleanup syscall: ‘rmdir’,
npm WARN cleanup path: ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules\@appium\base-driver\node_modules\axios’
npm WARN cleanup }
npm WARN cleanup ],
npm WARN cleanup [
npm WARN cleanup ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver’,
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir ‘C:\Users\mkhan.appium\node_modules\appium-uiautomator2-driver\node_modules@appium\base-driver\node_modules’] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: ‘EPERM’,
npm WARN cleanup syscall: ‘rmdir’,
npm WARN cleanup path: ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules\@appium\base-driver\node_modules’
npm WARN cleanup }
npm WARN cleanup ],
npm WARN cleanup [
npm WARN cleanup ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver’,
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir ‘C:\Users\mkhan.appium\node_modules\appium-uiautomator2-driver\node_modules@appium\base-driver’] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: ‘EPERM’,
npm WARN cleanup syscall: ‘rmdir’,
npm WARN cleanup path: ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules\@appium\base-driver’
npm WARN cleanup }
npm WARN cleanup ],
npm WARN cleanup [
npm WARN cleanup ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules\@appium’,
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir ‘C:\Users\mkhan.appium\node_modules\appium-uiautomator2-driver\node_modules@appium\support\node_modules\sharp\vendor’] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: ‘EPERM’,
npm WARN cleanup syscall: ‘rmdir’,
npm WARN cleanup path: ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules\@appium\support\node_modules\sharp\vendor’
npm WARN cleanup }
npm WARN cleanup ],
npm WARN cleanup [
npm WARN cleanup ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules\@appium\support’,
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir ‘C:\Users\mkhan.appium\node_modules\appium-uiautomator2-driver\node_modules@appium\support\node_modules\sharp’] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: ‘EPERM’,
npm WARN cleanup syscall: ‘rmdir’,
npm WARN cleanup path: ‘C:\Users\mkhan\.appium\node_modules\appium-uiautomator2-driver\node_modules\@appium\support\node_modules\sharp’
npm WARN cleanup }
npm WARN cleanup ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\mkhan.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-chromedriver
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install-npm.js
npm ERR! dbug ChromedriverGoogleapisStorageClient Parsed 776 entries from storage XML
npm ERR! info ChromedriverGoogleapisStorageClient The total count of entries in the mapping: 546
npm ERR! info ChromedriverChromelabsStorageClient The total count of entries in the mapping: 1250
npm ERR! dbug ChromedriverStorageClient Selecting chromedrivers whose versions match to 117.0.5938.149
npm ERR! dbug ChromedriverStorageClient Got 5 items
npm ERR! dbug ChromedriverStorageClient Selecting chromedrivers whose platform matches to win:intel64
npm ERR! dbug ChromedriverStorageClient Got 1 item
npm ERR! dbug ChromedriverStorageClient Excluding older patches if present
npm ERR! dbug ChromedriverStorageClient Versions mapping: {
npm ERR! dbug ChromedriverStorageClient “117”: [
npm ERR! dbug ChromedriverStorageClient “117.0.5938.149”
npm ERR! dbug ChromedriverStorageClient ]
npm ERR! dbug ChromedriverStorageClient }
npm ERR! dbug ChromedriverStorageClient Got 1 driver to sync: [
npm ERR! dbug ChromedriverStorageClient “117.0.5938.149/chromedriver-win64.zip”
npm ERR! dbug ChromedriverStorageClient ]
npm ERR! dbug ChromedriverStorageClient Retrieving ‘https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5938.149/win64/chromedriver-win64.zip’ to ‘C:\Users\mkhan\AppData\Local\Temp\2023911-19916-19z03tj.lr9t\0.zip’
npm ERR! [10:38:32] Error installing Chromedriver: ENOTEMPTY: directory not empty, rmdir ‘C:\Users\mkhan\AppData\Local\Temp\2023911-19916-19z03tj.lr9t’
npm ERR! [10:38:32] Error: ENOTEMPTY: directory not empty, rmdir ‘C:\Users\mkhan\AppData\Local\Temp\2023911-19916-19z03tj.lr9t’
npm ERR! [10:38:32] Downloading Chromedriver can be skipped by setting the’APPIUM_SKIP_CHROMEDRIVER_INSTALL’ environment variable.