I am trying to run a react native application in Android from Linux server, now I am getting this error when trying to start npm server with npm-start'
.
> [email protected] start /home/lenovot430/Documents/ReactProjects/test0app
> node node_modules/react-native/local-cli/cli.js start
┌──────────────────────────────────────────────────────────────────────────────┐
│ │
│ Running Metro Bundler on port 8081. │
│ │
│ Keep Metro running while developing on any JS projects. Feel free to │
│ close this tab and run your own Metro instance if you prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::8081
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at Promise (/home/lenovot430/Documents/ReactProjects/test0app/node_modules/metro/src/index.js:253:20)
at new Promise (<anonymous>)
at Object.<anonymous> (/home/lenovot430/Documents/ReactProjects/test0app/node_modules/metro/src/index.js:252:14)
at Generator.next (<anonymous>)
at asyncGeneratorStep (/home/lenovot430/Documents/ReactProjects/test0app/node_modules/metro/src/index.js:46:24)
at _next (/home/lenovot430/Documents/ReactProjects/test0app/node_modules/metro/src/index.js:66:9)
at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node node_modules/react-native/local-cli/cli.js start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/lenovot430/.npm/_logs/2019-04-29T09_09_45_424Z-debug.log
If I try 'react-native run-android', app is stuck at loading screen.
The fixes I tried for fixing it
Removed Node Modules, cleaned caches and installed again.
rm -rf node_modules && npm cache clean --force && npm install
Uninstalled and Reinstalled Watchman
brew uninstall watchman brew link pcre brew install --HEAD watchman brew install watchman
Cloned watchman repo and tried version 4.9.0
$ git clone https://github.com/facebook/watchman.git $ cd watchman $ git checkout v4.9.0 # the latest stable release $ ./autogen.sh $ ./configure $ make $ sudo make install
I havent made any configuration changes in the react native app. I tried making a new project with react-native init
, but in that project also, I am getting the same Error.
My package.json
file
{
"name": "test0app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.5"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/runtime": "^7.4.4",
"babel-jest": "^24.7.1",
"jest": "^24.7.1",
"metro-react-native-babel-preset": "^0.53.1",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
react-native run-android
causing this error? – Abdul Kaweereact-native run-android
, the app is stuck at Loading from Screen.npm-start
is giving me this error. – mad_greasemonkeycommand shells
or program running through that port – Abdul Kawee