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

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

Related

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

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.

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

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

Failed to call function, _fbBatchedBridge is undefined[react-native][linux][android]

I have a problem, while running a react native application on an android device, my application works perfectly but when i debug it remotely, it shows this error.
I have a second terminal running with react-native start(also tried with npm start) a new chrome tab also gets open in my browser but it shows that error is related to debuggerWorker.js.
I cant understand whats happening, any help will be highly appreciated!!!
Environment: OS: Linux 4.15 Node: 10.0.0 Yarn: Not Found npm: 6.0.0 Watchman: 4.7.0Xcode: N/A Android Studio: 3.1 AI-173.4819257 Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: 0.55.4 =>