I just tried installing webpack via npm in a new project and received the following. Notice the error in below near the end:
PS D:\Workspaces\profile-jsnelders-com> npm install webpack webpack-cli --save-dev npm ERR! path D:\Workspaces\profile-jsnelders-com\node_modules\brorand\package.json.1891953989 npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall rename npm ERR! Error: EPERM: operation not permitted, rename 'D:\Workspaces\profile-jsnelders-com\node_modules\brorand\package.json.1891953989' -> 'D:\Workspaces\profile-jsnelders-com\node_modules\brorand\package.json' npm ERR! { Error: EPERM: operation not permitted, rename 'D:\Workspaces\profile-jsnelders-com\node_modules\brorand\package.json.1891953989' -> 'D:\Workspaces\profile-jsnelders-com\node_modules\brorand\package.json' npm ERR! cause: npm ERR! { Error: EPERM: operation not permitted, rename 'D:\Workspaces\profile-jsnelders-com\node_modules\brorand\package.json.1891953989' -> 'D:\Workspaces\profile-jsnelders-com\node_modules\brorand\package.json' npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'rename', npm ERR! path: 'D:\\Workspaces\\profile-jsnelders-com\\node_modules\\brorand\\package.json.1891953989', npm ERR! dest: 'D:\\Workspaces\\profile-jsnelders-com\\node_modules\\brorand\\package.json' }, npm ERR! stack: 'Error: EPERM: operation not permitted, rename \'D:\\Workspaces\\profile-jsnelders-com\\node_modules\\brorand\\package.json.1891953989\' -> \'D:\\Workspaces\\profile-jsnelders-com\\node_modules\\brorand\\package.json\'', npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'rename', npm ERR! path: 'D:\\Workspaces\\profile-jsnelders-com\\node_modules\\brorand\\package.json.1891953989', npm ERR! dest: 'D:\\Workspaces\\profile-jsnelders-com\\node_modules\\brorand\\package.json', npm ERR! parent: 'profile-jsnelders-com' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It's possible that the file was already in use (by a text editor or antivirus), npm ERR! or that you lack permissions to access it. npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended). npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\jsnel\AppData\Roaming\npm-cache\_logs\2020-02-06T20_06_02_861Z-debug.log PS D:\Workspaces\profile-jsnelders-com> npm install webpack webpack-cli --save-dev + webpack@4.41.5 + webpack-cli@3.3.10 added 10 packages from 6 contributors, updated 1 package and audited 8965 packages in 9.19s found 0 vulnerabilities PS D:\Workspaces\profile-jsnelders-com> npm ERR! the command again as root/Administrator (though this is not recommended). npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\jsnel\AppData\Roaming\npm-cache\_logs\2020-02-06T20_06_02_861Z-debug.log
I just re-ran the npm install ...
again and it worked fine the second time. As the message suggests, it was probably a system process in Windows locking the file the first time.