npm-windows-upgrade not working

2019-07-24 05:33发布

问题:

When I run npm install --global --production npm-windows-upgrade it seems to go to work but then give me a few errors:

Error: EPERM: operation not permitted, rename 'C:\Users\MyUserName\AppData\Roaming\npm\node_modules.staging\lodash-36ccc657' -> 'C:\Users\MyUserName\AppData\Roaming\npm\node_modules\npm-windows-upgrade\node_modules\lodash'

Error: EPERM: operation not permitted, rename 'C:\Users\MyUserName\AppData\Roaming\npm\node_modules.staging\lodash-36ccc657' -> 'C:\Users\MyUserName\AppData\Roaming\npm\node_modules\npm-windows-upgrade\node_modules\lodash'

Error: EPERM: operation not permitted, rename 'C:\Users\MyUserName\AppData\Roaming\npm\node_modules.staging\lodash-36ccc657' -> 'C:\Users\MyUserName\AppData\Roaming\npm\node_modules\npm-windows-upgrade\node_modules\lodash'

I don't have a .staging folder under node_modules. Has anyone had this problem?

回答1:

Are you running that as an administrator ? This is what documentation says, first, ensure that you can execute scripts on your system by running the following command from an elevated PowerShell. To run PowerShell as Administrator, click Start, search for PowerShell, right-click PowerShell and select Run as Administrator.

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

Then, to install and use this upgrader tool, run (also from an elevated PowerShell or cmd.exe):

npm install --global --production npm-windows-upgrade
npm-windows-upgrade

I wasn't sure if you have already followed the instructions here: https://www.npmjs.com/package/npm-windows-upgrade