Getting EISDIR error from NodeJS when attempting to start app via Expo (React Native) - javascript

I'm getting the old 'directory is not a file' error with Node, and the output does not make it clear what exactly it's trying to parse. I've tried putting logging in and everything to find the issue, and even created a brand new project but the issue persists. Can anyone shed any light on this?
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (fs.js:592:3)
at tryReadSync (fs.js:366:20)
at Object.readFileSync (fs.js:403:19)
at UnableToResolveError.buildCodeFrameMessage (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:304:17)
at new UnableToResolveError (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:290:35)
at ModuleResolver.resolveDependency (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:168:15)
at DependencyGraph.resolveDependency (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph.js:353:43)
at C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\lib\transformHelpers.js:271:42
at C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\Server.js:1098:37
at Generator.next (<anonymous>)

The problem turned out to be that some of the versions of modules that I installed using npm were not compatible with expo. These were indicated earlier than the error in the output for the 'expo start' command. Because these were info logs, I didn't pay enough attention to them. However, after several hours I decided to fix them and it fixed my problem.
The fix was to follow each individual package named in the output and run 'expo install '.

Make sure the entryPoint key in your app.config.js or app.json file is correctly set.

I had an intermittent error very similar to this and it was related to a bug with remote debugging.
Turning off "Debug Remote JS" in the Expo Go app shake-to-show developer menu avoided this issue for me (logs and errors still show in the Metro console).
Here's the exact error message I was getting (and sometimes the app would just fail silently without any error). It's almost identical to the error in the question with a few different line numbers (maybe from different versions).
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (node:fs:721:3)
at tryReadSync (node:fs:431:20)
at Object.readFileSync (node:fs:477:19)
at UnableToResolveError.buildCodeFrameMessage
As for "why", there's some related discussion on this expo forum thread which in turn links to this React Native bug (claimed to be fixed in Expo CLI 4.13.1 but many users reporting similar issues in recent versions).
It might be related to the reported issues with Reanimated 2 and Expo's remote debugging (see this reanimated issue and the warning note in Expo's documentation) for Reanimated.

Related

SyntaxError: Unexpected token in JSON at position 0 in meteor

I am getting an error when running meteor.js. This is the following error:
PS C:\Users\ketan\Documents\Meteor> meteor run
C:\Users\ketan\AppData\Local\.meteor\packages\meteor-tool\2.1.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\meteor-promise\promise_server.js:218
throw error;
^
SyntaxError: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at ProjectContext._readResolverResultCache (C:\tools\project-context.js:605:16)
at ProjectContext.reset (C:\tools\project-context.js:245:10)
at new ProjectContext (C:\tools\project-context.js:60:8)
at Command.doRunCommand [as func] (C:\tools\cli\commands.js:356:24)
at C:\tools\cli\main.js:1528:15
I can't understand the error. Please tell me the solution for this.
Note: My laptop shut down in the previous session of the meteor.
The Solution
How I ultimately ended up fixing this was just by re-cloning the repository I was working on from GitHub - after this, my application ran fine.
NOTE: I've edited this answer because I originally thought Jankaput's answer worked for me, but after digging a little further I found that it didn't.
More Info
I ran into the same problem after a shutdown while a previous Meteor process was running.
For me, running meteor reset and re-installing node_modules seemed to prevent the mentioned error from happening, but when I ran the application, I noticed odd behavior from several different sections of the application (i.e. certain packages wouldn't work, some methods that normally run fine on startup threw errors, etc.)
This makes me think that some sort of project setting was corrupted due to the meteor server I was running ending abnormally when I force shut down my computer. I'm not sure why whatever setting was corrupted managed to stay that way across a meteor reset (since meteor --help specifies that it 'Resets the project state'), but the fact that a re-cloning work makes me think that it did.
Due to the fact that it seems like running meteor reset could allow some corrupted project settings to fly under the radar after this issue pops up, I personally feel that it's probably just best to re-clone your project if this happens to you, just to be sure that nothing about the project is corrupted.
This appears to me that you have a syntax error in a JSON file that is being read by the Meteor build tool. Do you have a settings.json file in use in your project? If so, check for trailing commas or keys missing double quotes as these are the most common errors introduced to a JSON file.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'

I am developing a mobile app with using react-native on WebStorm and trying to test it via an Android emulator(Pixel API 28) which I created via using AVD Manager of Android Studio. The problem is when I run the react-native run-android command, I get the following error:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration
':app:debugRuntimeClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :app
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from
https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
> Could not HEAD
'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> Connect to jcenter.bintray.com:443 [jcenter.bintray.com/35.158.228.205, jcenter.bintray.com/3.120.47.203] failed: Read timed out
I tried to clean up the cache with using the command below but it did not worked:
npm cache clean --force
I could not find some similar problems on the web and I am not sure what to show related with this problem.
When I try to run one of my previous project which was perfectly running, after getting this error and I saw that it also throws the same error. Similarly, when I create a new react-native project and try to run it, then I also got the same error. How can I solve this?
I am still loking for a solution. Anyone knows how to solve it?
I finally figured out the problem. I was connecting to internet via my school's network and it was restricting some downloads. So, that is why I got this error. For the ones who encountered with the same error, try to connect to the link in the error to if it is forbidden or not.

Error when migrating to macOS: TypeError: Cannot read property 'apply' of undefined

I am building a web app using React and Redux on the front end and Node on the back end with Express and MongoDB.
My app runs fine on my Windows machine. Today, I cloned the repository onto my macOS device and ran npm install inside the client and the root directory and then I tried running the application to find this error message pop up:
I'm not sure what this error message means and stack trace displays that the error originates from Redux inside the node_modules folder, which is code I did not write or touch. Here is the repo: https://github.com/furtivepygmy/devconnector
I'm new here, so please go easy on me. I always face issues when moving my workspace between macOS and Windows, however I can't seem to fix this one. Is there something I need to do when migrating between operating systems?

React-Native Could not get batchedBridge Error

I am a beginner in React Native (version 0.40.0) and I have encountered a problem while developing a project. When I run npm start (npm version-4.6.0) I get no errors and the packager starts normally. Running react-native run-android also doesn't give any errors however when the app starts in the Android Emulator( Nexus 6 API 23 ) I see the "Unfortunately app had to be closed" notice. The logcats in Android Studio are:
07-22 04:56:15.504 5325-5353/com.downtofood E/AndroidRuntime: FATAL EXCEPTION: mqt_js
Process: com.downtofood, PID: 5325
java.lang.RuntimeException: com.facebook.react.devsupport.JSException: Could not get BatchedBridge, make sure your bundle is packaged correctly
at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:24)
at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:158)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.onNativeException(CatalystInstanceImpl.java:431)
at com.facebook.react.cxxbridge.CatalystInstanceImpl.access$400(CatalystInstanceImpl.java:51)
at com.facebook.react.cxxbridge.CatalystInstanceImpl$NativeExceptionHandler.handleException(CatalystInstanceImpl.java:447)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:33)
at android.os.Looper.loop(Looper.java:148)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:818)
Caused by: com.facebook.react.devsupport.JSException: Could not get BatchedBridge, make sure your bundle is packaged correctly
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:148) 
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
at java.lang.Thread.run(Thread.java:818) 
Caused by: com.facebook.jni.CppException: Could not get BatchedBridge, make sure your bundle is packaged correctly
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
at android.os.Looper.loop(Looper.java:148) 
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
at java.lang.Thread.run(Thread.java:818) 
Please let me know what I can do to resolve this issue.
I'm just going to quote a solution form this issue on the official react-native github repository.
react-native run-android
react-native start --reset-cache
To better understand how this works and to look for another solution there are several issues under similar name/tags on the issue page of the repository itself.

Error: GET http://localhost:4200/assets/vendor.js net::ERR_INVALID_CHUNKED_ENCODING, on Ember.js server

I am just getting started with Ember.js at v2.9.0, followed the tutorial on their page https://guides.emberjs.com/v2.9.0/tutorial/ember-cli/, all good, save for one detail: Whenever I tried to refresh or load the development web app on Chrome browser after executing ember server on the cmd, the app would not load in browser and provide the following error most of the time (there were other errors as well but seem to be related to this one):
GET http://localhost:4200/assets/vendor.js net::ERR_INVALID_CHUNKED_ENCODING
, and one of the related errors is:
Uncaught ReferenceError: define is not defined
at application.js:1
I have searched for this specific error but without luck, I tried some fix hints found, such as clearing some persistent data with the netsh command, doing an npm cache clean bower cache clean, deleting the node_modules and the bower_components folders and reinstalling dependencies; also ensuring that there was no weird proxy configuration in my LAN settings, etc.
I have encountered this error while following the tutorial, and it would kind of be bypassed by refreshing the browser a few times until the app displayed. That was before, but now the refresh does not work when working on an existing application.
I am on:
Windows 10
ember-cli v.2.9.1
node.js LTS v.6.9.1
I need to get going with this rather soon, so any hint to resolve this issue is appreaciated. Thanks!
Might be a conflicting process running... Are you working over a VPN? If so, take a look at https://superuser.com/questions/893908/err-invalid-chunked-encoding-from-chrome

Categories