Getting windows rename error when attempting to run create-react-native-app myApp
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
$ 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/[email protected]: Please switch to @expo/spawn-async, the new name of this package. It's the same code with our new name.
[email protected] C:\dev\training\drrug
+-- [email protected] extraneous
+-- [email protected] extraneous
+-- [email protected] extraneous
+-- [email protected] extraneous
+-- [email protected] extraneous
+-- [email protected] extraneous
+-- [email protected] extraneous
+-- [email protected] extraneous
+-- [email protected] extraneous
`-- [email protected] 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
Please run these commands in the project folder and fill in their results:
npm ls react-native-scripts:npm ERR! code 1
npm ls react-native:npm ERR! code 1
npm ls expo:npm ERR! code 1
node -v: v6.9.1npm -v: 3.10.8yarn --version: bash: yarn: command not foundwatchman version: bash: watchman: command not foundAlso specify:
App wouldn't setup, so no demo except for above stack trace.
You have found the problem ?
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?
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.
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!
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!
@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
thanks @johnnyreilly! nice post
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?
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'
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
these links may be helpful:
alas this is not a create-react-native-app issue but a npm issue
Close any Node.Js process and retry with a new prompt window
@bleuscyther worked for my, i had my react app running while i was trying to download react-navigation.
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
@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!
Awesome @hmafzal!
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.
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!
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.
Upgrading the npm using npm install -g npm as resolved the issue for me.
@afturner indeed, same for Dropbox, paused syncing fixed the issue...
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.
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/
Closing the project in expo XDE before installing solved my problem
Instead of turning off Windows Defender Real-Time protection I just set a folder exclusion.
I get the error with npm 5.4 but not with npm 5.3. Maybe try this:
npm -g i [email protected]
This does not seem to be an issue with create-react-app. I got the same problem with other apps as well.
It seems to be the Node.js issue https://github.com/isaacs/node-graceful-fs/issues/104#issuecomment-335495181 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 https://github.com/isaacs/node-graceful-fs/pull/119
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.
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.
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.
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.
@johnnyreilly thanks... had the same issue.
All I did was close VS Code and re-ran the command; that did the trick, no errors.
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.
@fmeira thanks, your suggestion works.
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.
Most helpful comment
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!