"Error: ENOENT: no such file or directory", when using React Native with Hermes - react-native

Whenever there is an error in my code while running expo with Hermes locally, I get this error message as well:
Error: ENOENT: no such file or directory, open 'C:\Users\kudo\01_Work\Repos\expo\expo\android\versioned-react-native\ReactAndroid\hermes-engine\.cxx\MinSizeRel\6d3b5k69\x86\lib\InternalBytecode\InternalBytecode.js'
Now if I fix the code error, for instance a missing bracket, the aforementioned error also disappears and everything works. However, this error appears no matter what error is in my code, and it's quite lengthy and is preventing me from debugging. If I remove Hermes, the error also disappears, but I would like to use Hermes.
Here is my env info:
expo-env-info 1.0.5 environment info:
System:
OS: Windows 10 10.0.19044
Binaries:
Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.1.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: AI-212.5712.43.2112.8609683
npmPackages:
expo: ^46.0.0 => 46.0.15
react: 18.0.0 => 18.0.0
react-dom: 18.0.0 => 18.0.0
react-native: 0.69.6 => 0.69.6
react-native-web: ~0.18.7 => 0.18.9
Expo Workflow: managed
Things I've tried:
rm -rf node_modules
npm cache clean --force
Deleting the metro_cache folder in appdata
npx expo start --clear
I expected the error to no longer appear, however the aforementioned steps did nothing at all.

Related

Error: ENOENT: no such file or directory, open 'fs.js

I am working in React Native using expo-cli.
All I did till now is
expo init myapp
And after adding a text to my app.js file, I tried to do
npm start
which gave me this error
Error: ENOENT: no such file or directory, open 'fs.js
I have not used anything related to fs.js and as far as I can see from the errors page, the error is in
.../node_modules/metro/src/Server.js:99:24)
And other file stack system is referring it to metro.
I am using VS code and Linux Mint for development. My expo version is: 4.3.0
The result of expo diagnostics
Expo CLI 4.3.0 environment info:
System:
OS: Linux 5.4 Linux Mint 20.1 (Ulyssa)
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 10.19.0 - /usr/bin/node
npm: 6.14.4 - /usr/bin/npm
npmPackages:
expo: ~40.0.0 => 40.0.1
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2
react-native-web: ~0.13.12 => 0.13.18
npmGlobalPackages:
expo-cli: 4.3.0
Expo Workflow: managed
try to start as an administrator with sudo yarn start
I managed to solve it here but I'm not sure what caused this problem.
first i restarted the computer, when i did this another error similar to this one appeared
How can i make this working. I tried giving sudo permissoins
so I ran
chmod -R 0777 / tmp
But it didn't work. so I deleted the node module and ran
sudo yarn install
yarn start --reset-cache
And the problem was solved

Failed to install expo package with error: yarnpkg exited with non-zero code: 1 yarnpkg exited with non-zero code: 1

Im currently trying to update my Expo SDK from 36.0.0 to atleast 37.0.0 with the command expo update
however im getting the error:
× Failed to install expo package with error: yarnpkg exited with non-zero code: 1
yarnpkg exited with non-zero code: 1
Error: yarnpkg exited with non-zero code: 1
at ChildProcess.completionListener (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\spawn-async\src\spawnAsync.ts:65:13)
at Object.onceWrapper (events.js:422:26)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.cp.emit (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
...
at Object.spawnAsync [as default] (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\spawn-async\src\spawnAsync.ts:26:19)
at YarnPackageManager._runAsync (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\package-manager\src\NodePackageManagers.ts:288:31)
at YarnPackageManager.addAsync (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\package-manager\src\NodePackageManagers.ts:241:16)
at upgradeAsync (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\src\commands\upgrade.ts:465:5)
at C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\src\commands\upgrade.ts:701:7
at Command.<anonymous> (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:302:7)
npm version : 6.14.8
yarn version : 2.2.2 i also tried it with a lower version 1.x.x
expo diagnostics :
Expo CLI 3.27.4 environment info:
System:
OS: Windows 10 10.0.19041
Binaries:
Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
Yarn: 2.2.2 - C:\Users\Philipp\AppData\Roaming\npm\yarn.CMD
npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
npmPackages:
expo: ^36.0.0 => 36.0.2
react: 16.9.0 => 16.9.0
react-dom: 16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz => 0.61.4
react-native-web: ^0.11.7 => 0.11.7
react-navigation: 3.11.1 => 3.11.1
Expo Workflow: managed
Hopefully someone can help me, any help is appreciated. Thank you very much!
This is one way how I solved this issue.
I deleted the yarn.lock file & .expo folder and tried running expo upgrade and it worked.
I was upgrading from SDK 44 to SDK 45.
remove this line from package.json
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz"
now remove node_modules
now:
yarn install
now add that line back in package.json
again
yarn install
now if it succeeds, do a
expo upgrade
I solved after 2 days
I ran yarn install (npm install should do the same thing.) in my project folder first. Then expo upgrade command worked.
By any chance is this a monorepo? I ran into this error because I accidentally upgrade expo in the root folder
I ran yarn install (npm install should do the same thing.) in my project folder first. Then expo upgrade command worked.
just install expo-notifications using normal package installation as below
instead of expo install expo-notifications use
npm i expo-notifications
I was running expo upgrade from root directory of my app and experienced the same error
I changed to the directory of my mobile app and it ran successfully without any errors
Only thing I did is to delete the yarn.lock
then run the upgrade command, the non-zero error goes away
This is one way how I solved this issue.
I deleted the yarn.lock file & .expo folder and tried running expo upgrade and it worked.
I was upgrading from SDK 44 to SDK 45.
I deleted the yarn.lock file and tried running expo upgrade and it worked.

Metro bundler Error When I run expo start

I am working on a react native expo project. I was running expo start with no problem until I updated my MacBook. Now, I am facing this error:
Could not get status from Metro bundler. Connect ECONNREFUSED 127.0.0.1:19003
Connecting to Metro bundler failed.
My expo diagnostics is as below:
Expo CLI 3.22.3 environment info:
System:
OS: macOS 10.15.5
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.18.3 - /usr/local/bin/node
npm: 6.14.6 - /usr/local/bin/npm
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6200805
Xcode: 11.6/11E708 - /usr/bin/xcodebuild
npmPackages:
expo: ^38.0.0 => 38.0.8
react: 16.11.0 => 16.11.0
react-dom: 16.11.0 => 16.11.0
react-native: https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz =>
0.62.2
react-native-web: ~0.11.7 => 0.11.7
npmGlobalPackages:
expo-cli: 3.22.3
Ciao, according to this github page, you can:
Restart your computer
Run rm -rf .expo
Instead, according to Expo forum you can try to launch expo start with -c like expo start -c

cli : unable to talk to your watchman

I am new to React Native and I am trying to set up my development environment on Windows 8.1 as described in the official documentation.
But I have a problem
Steps :
react-native init AwesomeProject
cd AwesomeProject
react-native start
The app doesn't start correctly and I have this error :
2020-05-26T18:02:48,578: [cli] unable to talk to your watchman on \\.\pipe\watchman-ME! (No such file or directory)
Watchman: watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2020-05-26T18:02:48,578: [cli] unable to talk to your watchman on \\.\pipe\watchman-ME! (No such file or directory)
So I figured the problem is with watchman
I found the path on this error weird (\\.\pipe\watchman-ME!) because when executing react-native info, I get the following :
System:
OS: Windows 8.1 6.3.9600
CPU: (8) x64 Intel(R) Core(TM) i7-4702MQ CPU # 2.20GHz
Memory: 4.36 GB / 7.93 GB
Binaries:
Node: 13.2.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.19.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.13.1 - C:\Program Files\nodejs\npm.CMD
Watchman: 20200424.164118.0 - C:\Users\ME\AppData\Local\watchman\watchman.EXE
SDKs:
Android SDK:
API Levels: 26, 27, 28, 29
Build Tools: 28.0.3, 29.0.2, 30.0.0
System Images: android-29 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6392135
Languages:
Java: 1.8.0_241 - /c/Program Files/Java/jdk1.8.0_241/bin/javac
Python: 2.7.17 - /c/Python27/python
npmPackages:
#react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
Is my configuration correct ? Because I read other posts, issues and the best recommendation was to reinstall watchman and reboot. I did it multiple times but no changes. If that matters I downloaded the latest CI build, extracted it and added it to the path as described in the docs.
But I keep getting the same error, I tried with existing and new projects as well.
EDIT :
When I start the app, I said it doesn't start correctly, what happens is that it actually opens a white screen with a green bar saying Loading from 10.0.2.2:8081 ..., I read about it (example) and I tried every proposed solution, everything seems all right but I keep getting the same error !

react-native eject error Unrecognized command "eject"

I'm trying to eject my app to generate Android folder. I knew it worked before, but when I type react-native eject in my React Native project's root directory I'm getting:
can-mbp:MyApp can$ react-native eject
warn Your project is using deprecated "rnpm" config that will stop working from next release. Please use a "react-native.config.js" file to configure the React Native CLI. Migration guide: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
warn Package "bugsnag-react-native" is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.
warn Package "react-native-onesignal" is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.
warn Package react-native-onesignal has been ignored because it contains invalid configuration. Reason: Unknown option dependency.platforms.ios.sourceDir with value ""./ios"" was found. This is either a typing error or a user mistake. Fixing it will remove this message.
error Unrecognized command "eject".
info Run "react-native --help" to see a list of all available commands.
I've searched for it but every answer points out to that react-native eject is simply the correct form and I couldn't find anything regarding that it doesn't work.
Here is my system info from react-native info command:
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU # 3.10GHz
Memory: 62.21 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.4.0 - /usr/local/bin/node
Yarn: 1.17.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.0-rc.2 => 0.60.0-rc.2
What am I doing wrong?
Since create-react-native-app is deprecated this functionality is no longer needed.
Due to this pr it's gone!
Personaly I don't like it but run npx react-native init YourProjectName and copy over what's necessary.
Update :
I copied to removed code and made a small package : https://www.npmjs.com/package/react-native-eject
Always working for me, first install in your project
yarn add react-native-eject
and then run
react-native eject
make sure you have install yarn in your pc
Type the following command
npx react-native eject