facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.46k stars 24.25k forks source link

Windows & Android: react native server crashes very often #9136

Closed pvllnspk closed 7 years ago

pvllnspk commented 8 years ago
 ERROR  EPERM: operation not permitted, lstat '...\.idea\workspace.xml___jb_old___'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"...\.idea\\workspace.xml___jb_old___"}
Error: EPERM: operation not permitted, lstat 'app\.idea\workspace.xml___jb_old___'
    at Error (native)

After that I should again do:

npm start

How to resolve this quite annoying problem? Thanks

chardlau commented 8 years ago

I got the same problem after i modified a js file. I try modifying project directory‘s access level, grant total access permission to all users, but on work. It seems the packager program 's run time user has no permission. I don't know. Hope somebody help.

chardlau commented 8 years ago

I solve the problem by install watchman. The same issues gave the method: https://github.com/facebook/react-native/issues/4204 watchman: https://facebook.github.io/watchman/ download url is: http://bit.ly/watchmanwinalpha windows is still alpha support, see this: https://github.com/facebook/watchman/issues/19 after extract watchman and set path env, restart idea, the problem do not happend again.

withparadox2 commented 8 years ago

@chardlau doesn't solve my problem, I have no idea why just adding watchman to env path can avoid such error

withparadox2 commented 8 years ago

I think I find another solution, but not quite sure, help me check it. After crawling files, a watcher will be added on these files, so what if I ignore such files under .idea?

Add one method in local-cli\default.config.js

  getBlacklistREMore(platform, additionalList) {
    return blacklist(platform, additionalList);
  },

Change code of method getPackagerServer In local-cli\server\runServer.js from blacklistRE: config.getBlacklistRE(), to blacklistRE: config.getBlacklistREMore(null, [/\.idea.*/]),

Done. Let me know if anything described here is wrong.

pvllnspk commented 8 years ago

Now it cries about build folder \build\generated\source\r\debug\android\support\design\R.java' @withparadox2 How to properly handle it?

withparadox2 commented 8 years ago

@pvllnspk I have never come cross errors like yours, could you paste the detail message? And need to tell you the truth I got the error again after the server running for several hours, it's still related to 'workspace.xml_jbold'.

pvllnspk commented 8 years ago

@withparadox2, so seems like we need to find another solution, let's keep in touch

pvllnspk commented 8 years ago

any news?

pvllnspk commented 8 years ago

https://github.com/facebook/react-native/issues/7174 http://stackoverflow.com/questions/38701115/windows-android-react-native-server-crashes-very-often/38831876#38831876

Rmaan commented 8 years ago

For the record:

The only temporarily workaround I found was to change behavior of react cli on exceptions. Open node_modules/react-native/local-cli/server/server.js find process.on('uncaughtException', line and comment process.exit(1); at the end to completely disable quit on exception.

ericnakagawa commented 7 years ago

Hi folks, are you folks still experiencing this issue?

minhchu commented 7 years ago

I didnt experience this issue from RN v0.37 (still crash on 0.36 very often)

anthony-skr commented 7 years ago

Experiencing the same on 0.39.2 with .idea and .git folders

ericnakagawa commented 7 years ago

@pvllnspk @minhchu I'll be closing this issue since it looks like it is resolved since v0.37 and we are now at v0.37

ptol commented 7 years ago

I'll be closing this issue since it looks like it is resolved since v0.37 and we are now at v0.37

The problem still exists with v0.40

viettranme commented 7 years ago

I encounter this issue with v0.40 ONLY when including 'react-native-camera' library.

` FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 4 mins 35.965 secs Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/android-setup.html

(node:3816) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec tion id: 2): TypeError: Cannot read property 'message' of undefined `

Sanford284 commented 7 years ago

The problem still exists with v0.40. At the time error is occuring, the windows's taskbar will be stop, only restart system.

prattpratt commented 7 years ago

Confirm problem on Windows 7, react-native@0.40.0

 ERROR  EPERM: operation not permitted, lstat 'd:\project\project\.git\index.lock'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"d:\\project\\project\\.git\\index.lock"}
Error: EPERM: operation not permitted, lstat 'd:\project\project\.git\index.lock'
    at Error (native)

See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
wilomgfx commented 7 years ago

Same here. Windows 7, react-native@0.40.0 On WebStorm. image

prattpratt commented 7 years ago

This become really annoying :( I can't work in normal flow.

user471 commented 7 years ago

@ericnakagawa I think this issue should be reopened

wilomgfx commented 7 years ago

@ericnakagawa totally should be reopened.

petersobolev commented 7 years ago

Same problem, RN 0.40.0, Win7

Sanford284 commented 7 years ago

I hava solved it. see http://blog.csdn.net/real_bird/article/details/54691589

Rmaan commented 7 years ago

Is this a Windows 7 specific problem? Does anybody experiencing this issue with Windows 10?

scavezze commented 7 years ago

I have the same issue v 0.38 can i just tell that packager to ignore certain folders

codetony25 commented 7 years ago

+1 having this issue on React Native 0.39.2

omerdn1 commented 7 years ago

Should be reopened, can confirm I'm getting this issue on RN 0.40

anthony-skr commented 7 years ago

image

react-native --version react-native-cli: 1.3.0 react-native: 0.40.0

Win7 64

rajavijayach commented 7 years ago

I'm using Exponent. I'm also facing the same issue.

Error: EPERM: operation not permitted, lstat 'C:\code\REACT NATIVE\dinder\node_modules.staging\native-base-4ddfb251\dist' at Error (native)

rajavijayach commented 7 years ago

Solution(For Exponent Users) : In the Exponent XDE, there's a restart button. Try that. It will clear your cache, load all files(If you have recently installed any new stuff, in my case I had installed NativeBase framework, it will load that as well )

BookOfGreg commented 7 years ago

Thank you @yuwanlin , your fix to clean project in Android Studio worked for us.

codebymikey commented 7 years ago

This should resolve the issue for now.

In case the answer gets deleted, the solution is to go to File > Settings > System Settings > Synchronization. And uncheck Use "safe write" (save changes to a temporary file first).

Obviously this isn't a long term solution as it's checked by default for a reason.

prattpratt commented 7 years ago

@codebymikey, yes, seems this solution only works for WebStorm. For people who use VS Code this will not help.

Dashue commented 7 years ago

Windows 10 vscode v1.9.1 here

Johnson27 commented 7 years ago

It seems that the solution below works well for WebStorm. Didn't check out other editors.

In Webstorm, uncheck "File->Settings->System Settings->sychronization->use safe write"

Dashue commented 7 years ago

My issue came from having run vscode as an admin which created build folders my own user didn't have permissions on. Manually removed build folders and reset permissions solved it for me.

malcriad0 commented 7 years ago

This work for me: react-native start And when the load is complete type: react-native run-android

devenis commented 7 years ago

I've been using VSCode as well and faced the same problem. Since VSCode has no option like "safe write" that Webstorm got, i've set 2 options in the settings file of VSCode editor.

File -> Preferences -> Settings

Added:

"git.autorefresh": false, "git.autofetch": false,

This seemed to do the trick, i do not know if those options actually prevent the git file of being updated all the time you save changes to your code. I haven't faced the error message since then. Hope it helps someone.

Edit: By the way, as the settings above will deactivate the auto refresh VSCode holds with the Git status, whenever you need to check how many changes were made to the project, you just have to click on the Git button on the editor and it will update its status.

LearnShare commented 7 years ago

On win7, with VSCode and SourceTree, sometimes got that crash.

bexoss commented 7 years ago

Hi, I'm using RN 0.42 (latest), Windows 7 (64), and WebStorm.

I'm also facing similar problem very often. It seems like problem of permissions. I got an error when builder trying to create, or delete folder/files.

I already unchecked 'safe write' in WebStorm, but it didn't help for me. If I try to build 10 times, at least 5 times failed. It is very annoying. I can't concentrate on developing, how should I do?

1111

Dashue commented 7 years ago

I figured out it was happening once due to having created the files / folders as an admin. Deleting and creating as current user sorted it.

It also happened when done other process kept a handle to the files / folders. Maybe try to close your other programs and see if it goes away.

On 16 Mar 2017 8:29 a.m., "bexoss" notifications@github.com wrote:

Hi, I'm using Windows 7 (64), and WebStorm.

I'm also facing similar problem very often. It seems like problem of permissions. I got an error when builder trying to create, or delete folder/files.

I already unchecked 'safe write' in WebStorm, but it didn't help for me. If I try to build 10 times, at least 5 times failed. It is very annoying. I can't concentrate on developing, how should I do?

[image: 1111] https://cloud.githubusercontent.com/assets/12633102/23987666/048cc084-0a6e-11e7-8ddb-93f1c1daf7fb.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/9136#issuecomment-286989062, or mute the thread https://github.com/notifications/unsubscribe-auth/AAc6vTl5XCqKuic7nPbP9H6R4clsMhjjks5rmPL3gaJpZM4JZooz .

deejayxd07 commented 7 years ago

still getting this error on v0.41.2

woosungchu commented 7 years ago

Same error

C:\react-native-practice>react-native --version
react-native-cli: 2.0.1
react-native: 0.42.3
yygmind commented 7 years ago

Thanks @codebymikey , It works well for me through the solution, In Webstorm, uncheck "File->Settings->System Settings->sychronization->use safe write" I'm Win10, use Webstorm

jasan-s commented 7 years ago

on react-native 0.42 on windows 7 x64 using sublimeText. What is the accepted solution?

llioor commented 7 years ago

Same problem here... This is the output of React Packager..

Loading dependency graph, done.
 ERROR  EPERM: operation not permitted, lstat 'C:\wamp\www\nativetest\node_modul
es\react-native-fbsdk\android\src\main\res\values\strings.xml'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"C:\\wamp\\www\\nativetes
t\\node_modules\\react-native-fbsdk\\android\\src\\main\\res\\values\\strings.xm
l"}
Error: EPERM: operation not permitted, lstat 'C:\wamp\www\nativetest\node_module
s\react-native-fbsdk\android\src\main\res\values\strings.xml'
    at Error (native)
st0ffern commented 7 years ago

Whenever Android Studio starts gradle sync or to process files in the appdir. the watchdog on react-native will die with this error. Try to start simulator from console or start simulator from Android studio, then run react-native run-android close android studio and develop...

llioor commented 7 years ago

Hey @stoffern My simulator is avd... I'm working with phpStorm so I'm working with the console over there: Run android avd which open AVD manager with a list of devices and I start one of the devices. When the device is ready I run in the phpStorm react-native run-android which start to load all packages and then I see the error. I understood what you wrote but I don't understand how to implement it in my environment. Can you advice please?

When I run the commend "react-native run-android" I got this:

:app:generateDebugSources UP-TO-DATE      
:app:processDebugJavaRes UP-TO-DATE      
:app:compileDebugJavaWithJavac                 
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:7: error: package com.facebook.reactnative.androidsdk does not exist
import com.facebook.reactnative.androidsdk.FBSDKPackage;
                                          ^    
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:9: error: cannot find symbol
import com.facebook.CallbackManager;           
                   ^                           
  symbol:   class CallbackManager              
  location: package com.facebook               
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:10: error: cannot find symbol
import com.facebook.FacebookSdk;               
                   ^                           
  symbol:   class FacebookSdk                  
  location: package com.facebook               
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:11: error: package com.facebook.appevents does not exist
import com.facebook.appevents.AppEventsLogger; 
                             ^                 
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:27: error: cannot find symbol
  private static CallbackManager mCallbackManager = CallbackManager.Factory.create();
                 ^                             
  symbol:   class CallbackManager              
  location: class MainApplication              
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:29: error: cannot find symbol
  protected static CallbackManager getCallbackManager() {
                   ^                           
  symbol:   class CallbackManager              
  location: class MainApplication              
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:27: error: package CallbackManager does not exist
  private static CallbackManager mCallbackManager = CallbackManager.Factory.create();
                                                                   ^
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:43: error: cannot find symbol
            new FBSDKPackage(),                
                ^                              
  symbol: class FBSDKPackage                   
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:44: error: cannot find symbol
            new FBSDKPackage(),                
                ^                              
  symbol: class FBSDKPackage                   
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:48: error: cannot find symbol
            new FBSDKPackage(mCallbackManager) 
                ^                              
  symbol: class FBSDKPackage                   
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:61: error: cannot find symbol
    FacebookSdk.sdkInitialize(getApplicationContext());
    ^                                          
  symbol:   variable FacebookSdk               
  location: class MainApplication              
C:\wamp\www\nativetest\android\app\src\main\java\com\nativetest\MainApplication.java:63: error: cannot find symbol
    AppEventsLogger.activateApp(this);         
    ^                                          
  symbol:   variable AppEventsLogger           
  location: class MainApplication              
12 errors                                      
:app:compileDebugJavaWithJavac FAILED          

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:        
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED  

Total time: 17.866 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

I went through the getting start on the fackbook SDK and I did all in the right way. I noticed that in my node_modules I have only "reactnative" folder under react-native-fbsdk > android > src > main > java >com >facebook Is it ok? What else can be the problem?

Thank you

st0ffern commented 7 years ago

error: package com.facebook.reactnative.androidsdk does not exist

install android SDK... https://facebook.github.io/react-native/docs/getting-started.html#3-install-the-android-6-0-marshmallow-sdk

BTW Have you followed the instructions by details?

This is stackoverflow.. not a issue with react-native