These are the errors I am getting while updating from npm 10.9.2 to 11.1.0. I tried several commands to fix this issue, but none succeeded. If anyone has encountered this problem before, please share your solution.
npm error code EPERM
npm error syscall mkdir
npm error path C:\Users\YourUserName
npm error errno EPERM
npm error FetchError: Invalid response body while trying to fetch .1.0: EPERM: operation not permitted, mkdir 'C:\Users\YourUserName'
npm error at C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:170:15
npm error at async Response.json (C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:75:17)
npm error at async RegistryFetcher.packument (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\registry.js:98:25)
npm error at async RegistryFetcher.manifest (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\registry.js:128:23)
npm error at async #fetchManifest (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1202:20)
npm error at async #nodeFromEdge (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1040:19)
npm error at async #buildDepStep (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:904:11)
npm error at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:181:7)
npm error at async Promise.all (index 1)
npm error at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:131:5) {
npm error code: 'EPERM',
npm error errno: 'EPERM',
npm error syscall: 'mkdir',
npm error path: 'C:\\Users\\YourUserName',
npm error type: 'system',
npm error requiredBy: '.'
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It's possible that the file was already in use (by a text editor or antivirus),
npm error or that you lack permissions to access it.
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
npm notice
npm notice New major version of npm available! 10.9.2 -> 11.1.0
npm notice Changelog: .1.0
npm notice To update run: npm install -g [email protected]
npm notice
npm error Log files were not written due to an error writing to the directory: C:\Users\YourUserName\AppData\Local\npm-cache\_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal