Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: EPERM: operation not permitted, rename #191

Closed
Darper opened this issue May 5, 2017 · 35 comments
Closed

Error: EPERM: operation not permitted, rename #191

Darper opened this issue May 5, 2017 · 35 comments

Comments

@Darper
Copy link

Darper commented May 5, 2017

Description

Getting windows rename error when attempting to run create-react-native-app myApp

Expected Behavior

Following setup instructions, I installed create-react-native-app globally then attempted to create a new project. I have done this on Mac with no problem, but Windows returns a series of "operation not permitted" errors

Observed Behavior

$ create-react-native-app drrug
Creating a new React Native app in C:\dev\training\drrug.

Installing packages. This might take a couple minutes.
Installing react-native-scripts...

npm WARN deprecated @exponent/spawn-async@1.2.8: Please switch to @expo/spawn-async, the new name of this package. It's the same code with our new name.
drrug@0.1.0 C:\dev\training\drrug
+-- babel-runtime@6.23.0  extraneous
+-- cross-spawn@5.1.0  extraneous
+-- fs-promise@1.0.0  extraneous
+-- indent-string@3.1.0  extraneous
+-- inquirer@3.0.6  extraneous
+-- match-require@2.1.0  extraneous
+-- minimist@1.2.0  extraneous
+-- path-exists@3.0.0  extraneous
+-- progress@2.0.0  extraneous
`-- qrcode-terminal@0.11.0  extraneous

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "--save-exact" "react-native-scripts"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! path C:\dev\training\drrug\node_modules\.staging\@exponent\ngrok-fc327f2a
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'C:\dev\training\drrug\node_modules\.staging\@exponent\ngrok-fc327f2a' -> 'C:\dev\training\drrug\node_modules\@exponent\ngrok'
npm ERR!     at destStatted (C:\Users\dharper\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\dev\training\drrug\node_modules\.staging\@exponent\ngrok-fc327f2a' -> 'C:\dev\training\drrug\node_modules\@exponent\ngrok'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, rename 'C:\dev\training\drrug\node_modules\.staging\@exponent\ngrok-fc327f2a' -> 'C:\dev\training\drrug\node_modules\@exponent\ngrok'
npm ERR!     at destStatted (C:\Users\dharper\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\dev\training\drrug\node_modules\.staging\@exponent\ngrok-fc327f2a' -> 'C:\dev\training\drrug\node_modules\@exponent\ngrok'
npm ERR!     at Error (native) parent: 'drrug' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\dev\training\drrug\npm-debug.log
`npm install --save-dev --save-exact react-native-scripts` failed

Environment

Please run these commands in the project folder and fill in their results:

  • npm ls react-native-scripts:
    `-- (empty)

npm ERR! code 1

  • npm ls react-native:
    `-- (empty)

npm ERR! code 1

  • npm ls expo:
    `-- (empty)

npm ERR! code 1

  • node -v: v6.9.1
  • npm -v: 3.10.8
  • yarn --version: bash: yarn: command not found
  • watchman version: bash: watchman: command not found

Also specify:

  1. Operating system: Windows 7
  2. Phone/emulator/simulator & version: N/A

Reproducible Demo

App wouldn't setup, so no demo except for above stack trace.

@Sofiane-13
Copy link

You have found the problem ?

@anp
Copy link
Contributor

anp commented May 22, 2017

Are you able to install other npm-based projects in this directory? Do you have any antivirus that would prevent these files from being moved around? I'm not sure why you wouldn't have permission to rename the file, but this seems to me like a Windows/npm issue?

@Darper
Copy link
Author

Darper commented May 25, 2017

I've never had a problem with any other NPM projects in the past. I know that this is probably unique to my system, but I was hoping somebody would have seen the same issue. create-react-app works fine, but create-react-native-app still has the errors above.

@fmeira
Copy link

fmeira commented May 25, 2017

I got the same problem just doing an npm install.
Run with antivirus disabled (if you use Windows Defender, turn off Real-Time protection and Cloud-based protection). That worked for me!

@brentvatne
Copy link
Member

I'll assume that @fmeira's suggestion works and close this! If anyone has a solution for how we can just have this work out of the box for people with the same configuration as you folks then please open a PR or an issue with the idea!

@johnnyreilly
Copy link

@fmeira solution worked for me as well - it looks like Windows Defender has started to get more aggressive of late?! I've blogged about it to try and let others know - so strange... https://blog.johnnyreilly.com/2017/06/windows-defender-step-away-from-npm.html

@brentvatne
Copy link
Member

thanks @johnnyreilly! nice post

@expo expo deleted a comment from bhabanipattanayak Jul 9, 2017
@fedesardo
Copy link

I run npm install -g npm and also npm install and it did not work for me! Still unable to install using npm using command like this: ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID=xxxxxxxxx --save in my visual studio code. Any idea?

@Simoneth
Copy link

Here is my try: https://github.com/drhouse7/react-native-try

On Win8.1 I turned off Windows Defender Real-Time protection (I set also an exclusion to my node.exe path) however get this:

npm ERR! path C:\projects\combined\node_modules\.staging\es5-ext-c47e8e2a
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\projects\combined\nod
e_modules\.staging\es5-ext-c47e8e2a' -> 'C:\projects\combined\node_modules\es5-e
xt'

@kunokdev
Copy link

Hi, I am getting EPERM error when running npm start after fresh app initialization.
My environment is: Node 6.11.1 npm ~v3 , Ubuntu shell on Windows 10

@brentvatne
Copy link
Member

these links may be helpful:

alas this is not a create-react-native-app issue but a npm issue

@bleuscyther
Copy link

Close any Node.Js process and retry with a new prompt window

@ofirDubi
Copy link

@bleuscyther worked for my, i had my react app running while i was trying to download react-navigation.

@NULL-SWEAT
Copy link

I has having this problem at a university win7 machine.
Solved by disabling the anti-virus and on a new cmd prompt run npm cache verify

@hmafzal
Copy link

hmafzal commented Aug 3, 2017

@johnnyreilly thanks for the post and the bug report on VS Code! It ended up being VS Code for me too. Updating to 1.14 fixed the issue!

@johnnyreilly
Copy link

Awesome @hmafzal!

@afturner
Copy link

afturner commented Aug 3, 2017

This also happens for those that have their project directory within a Box sync folder. Perhaps with other services like Dropbox or Google Drive. Pausing the sync fixed the issue immediately.

@Spyrology
Copy link

Had this issue with create-react-app. Turning off anti-virus (Trend Micro) and running npm cache clean didn't work. Then ran npm cache verify and tried again (with anti-virus still off) - voila! Don't know whether npm cache verify alone would've sufficed in my instance, but thanks @fmeira and @NULL-SWEAT!

@jmmclean
Copy link

jmmclean commented Aug 8, 2017

I had this issue w/ a different module, but figured i'd comment here. My fix was upgrading node & npm (specifically npm) using nvm:
Old npm: 3.10.10
New npm: 5.3.0

Working now.

@apatti
Copy link

apatti commented Aug 18, 2017

Upgrading the npm using npm install -g npm as resolved the issue for me.

@tijsdeboeck
Copy link

@afturner indeed, same for Dropbox, paused syncing fixed the issue...

@sharad2803
Copy link

I got the same error,
"Error: EPERM: operation not permitted, scandir" after running with # npm i , and also not authorized to stop antivirus option (window defender) so tried to run separately in cmd or cmder instead of code editor @Terminal, it works for me.

@prageethmadhu
Copy link

prageethmadhu commented Sep 12, 2017

After huge struggle found the solution for me .. 👍

"Create new folders"
mkdir E:\Buildagent\npm
mkdir E:\Buildagent\npm-cache

"move npm prefix and the cache"
robocopy c:\Users\the-build-user\AppData\Roaming\npm E:\Buildagent\npm
robocopy c:\Users\the-build-user\AppData\Roaming\npm-cache E:\Buildagent\npm-cache /E /MOVE

"Update the npm config for prefix and cache"
npm config set prefix E:\Buildagent\npm
npm config set cache E:\Buildagent\npm-cache

https://alastaircrabtree.com/fixing-intermittant-eperm-operation-not-permitted-on-npm-install/

@rahulcreace
Copy link

rahulcreace commented Sep 19, 2017

Closing the project in expo XDE before installing solved my problem

@chetmurphy
Copy link

Instead of turning off Windows Defender Real-Time protection I just set a folder exclusion.

@apollocoder
Copy link

I get the error with npm 5.4 but not with npm 5.3. Maybe try this:

npm -g i npm@5.3

This does not seem to be an issue with create-react-app. I got the same problem with other apps as well.

@vladimiry
Copy link

vladimiry commented Nov 23, 2017

It seems to be the Node.js issue isaacs/node-graceful-fs#104 (comment) That would explain that such weird workaround as same for Dropbox, paused syncing fixed the issue... prevents issue happening, because probably there is no high concurrent access to the same files anymore after stopping file system scanning by Dropbox (antiviruses, whatever).

There are many issues on GitHub placed regarding the EPERM problem and looks like most of such issues just go to the "closed" state without the actual resolution. You can see more details here isaacs/node-graceful-fs#119

@EwanBd
Copy link

EwanBd commented Apr 6, 2018

We had this issue writing files from node to a remote server. We upgraded from v 0.12.2 to 8.10.0 and this began occurring, So we ran 'node cache verify' and it cleared the problem.

@pashute
Copy link

pashute commented Apr 25, 2018

Solved!! Turn off react-native. npm install, which will now work, and restart react-native. That's all.

I had the same problem. I couldn't understand why it told me to re-run from a cmd with admin permissions, while I was running with admin. Turned out that you have to close the running react-native-cli (which I had started with yarn start in a different admin-cmd window. )

So maybe to close this issue also add that to the user message. Something like: Close the react-native-cli or retry the installation from a command window with administrator permissions.

@timsar2
Copy link

timsar2 commented Apr 27, 2018

try to add full permission on npm folder
C:\Users\YourAccount_Aame\AppData\Roaming
just right click on npm and from security tab add full permison to your user account or add everyone(if security is not important) then set full permision to everyone.

@Uzairrrr
Copy link

I got the same problem just doing an npm install --save react-navigation
Run with antivirus disabled (if you use Windows Defender, turn off Real-Time protection and Cloud-based protection).
Worked for me.

@mockingloris
Copy link

@johnnyreilly thanks... had the same issue.
All I did was close VS Code and re-ran the command; that did the trick, no errors.

@neihcnim
Copy link

In windows 10, I don't see real time protection under windows defender. However, I see it under my antivirus software. Turning it off, the problem goes away.

@harshadduasane
Copy link

@fmeira thanks, your suggestion works.

@paras-shah
Copy link

After Turning off - real time protection in antivirus I had to delete my .gitignore as the command I was running creates it if does not exist so after this the problem goes away.

@expo expo locked as off-topic and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests