npm-windows-upgrade not working - node.js

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?

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

Related

Facing problem during setting up of Node Js in VS Code

I am trying to setup a ReactJS app on Windows using the following command:
npx create-react-app my-app
and the output is coming as :
PS C:\Users\santu\React-JS> npx create-react-app my-app
node:fs:1349
handleErrorFromBinding(ctx);
^
Error: EPERM: operation not permitted, mkdir 'my-app'
at Object.mkdirSync (node:fs:1349:3)
at Object.module.exports.makeDirSync (C:\Users\santu\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\mkdirs\make-dir.js:23:13)
at createApp (C:\Users\santu\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:257:6)
at C:\Users\santu\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:223:9
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errno: -4048,
syscall: 'mkdir',
code: 'EPERM',
path: 'my-app'
}
Solution 1
To make this run..You need to run my cmd as an administrator.
So run the below commands:
Run cmd as administrator
Run npm config edit (You will get notepad editor)
Change prefix variable to C:\Users\<User Name>\AppData\Roaming\npm
Then npm start works in a normal console.
OR
Solution 2
Try installing it globally first, using the command
npm install -g create-react-app
And then, you can create your app using the command,
npx create-react-app <Name of your app>
Hope this will help.
Edit: Above solution might work but it's not recommended way of solving this issue. Please refer the Link
I referred to the solution given at the bottom, also some other posts to use the below too:
command: npm config set cache "C:\Users\mycomputer~1name\AppData\Roaming\npm-cache" --global
try to update your npm Using npm#latest command to update the node package manager.
npm install npm#latest -g
after updating your package try
npx create-react-app my-app
you should be able to run without any issues
Run your cmd as administrator
or
Run vs code as administrator

nodejs will not enable corepack: operation not permitted

I have installed nodejs and i am trying to enable corepack with corepack enable but it gives me this error on windows:
Internal Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\pnpm'
Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\pnpm'
I can not find the pnpm folder is is refering to in the nodejs folder and i have tried to npm install -g pnpm which did install pnpm
how do I fix this?
Try running the cmd as administrator

Is there really no straightforward way to update node and npm on windows?

Have spent far too long on this, about to give up.
I know you can go to the official website to update Node but I would like to be able to do it through the command line.
Anyway, when I do npm install npm#latest -g
I get
npm ERR! code EEXIST
npm ERR! path D:\nodejs\npm.cmd
npm ERR! Refusing to delete D:\nodejs\npm.cmd: is outside D:\nodejs\node_modules\npm and not a link
npm ERR! File exists: D:\nodejs\npm.cmd
npm ERR! Move it away, and try again.
I found another solution but did not work for me:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install --global --production npm-windows-upgrade
npm-windows-upgrade
This works up to this far, then it asks me for which version I want to install. I select it, then I get:
You wanted to install npm 6.14.5, but the installed version is 6.13.4.
A common reason is an attempted "npm install npm" or "npm upgrade npm". As of today, the only solution is to completely uninstall and then reinstall Node.js. For a small tutorial, please see https://github.com/felixrieseberg/npm-windows-upgrade#usage.
Please consider reporting your trouble to https://aka.ms/npm-issues.
I am almost dead. Any help appreciated!
Have a look at
How can I update npm on Windows?
or
https://github.com/felixrieseberg/npm-windows-upgrade

Error: Uncaught Error: EPERM: operation not permitted, rename when installing electron app on windows

I'm creating an Electron app and when I try to install it on a Windows 7 32-bit machine I'm getting the following error:
Uncaught Error: EPERM: operation not permitted, rename 'D:\final-app\library\db\tmp_login.db~' -> 'D:\final-app\library\db\tmp_login.db'
I tried to
run cmd.exe as an administrator
run npm cache clean --force
run npm install -g npm#latest --force
But I'm still getting the same error. Am I doing something wrong?
In my situation it helped on windows:
clean cache with
npm cache clean --force
install the latest version of npm globally as admin:
npm install -g npm#latest --force
clean cache with
npm cache clean --force
Try to install your component once again.
npm ERR! Error: EPERM: operation not permitted, rename

Bower Installation

I am using a windows 8.1 maching,and trying to install the Bower automation tool via Git Bash. So what I found is this:
$ npm config set prefix /usr/local
$ npm install -g bower
$ which bower
>> /usr/local/bin/bower
However after typing the first command gitbash gives me this.
Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Git\usr\local'
at Error (native)
Why is this happening?
Thanks.

Resources