JS server not recognized while continuing to build

Wednesday

Windows 10

Npm 5.5.1

Reaction-native-cli 2.0.1

Reagent native 0.50.3

Genymotion Google Nexus 7 - API 6.0.0 23

Android stuff:

SDK version: 26

buildToolsVersion '26 .0.2 '

Target version: 26

compile "com.android.support:appcompat-v7:26.0.2"

I started npm start --reset-cache and reactively started --reset-cache, but the JS server is not recognized, continuing the build. This prevents packetization of packages before running on my emulator.

I followed solution 1 in this post:

https://github.com/facebook/react-native/issues/9136#issuecomment-306486102

as well as this one:

Unable to recognize JS server

- init. . , npm --reset-cache, , , . , npm , . . Gradle .

, ...

Emulator outputBash output

** **

index.js

import { AppRegistry } from 'react-native';
import App from './App';

AppRegistry.registerComponent('hihi', () => App);

App.js/** * React * https://github.com/facebook/react-native * @flow */

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' +
    'Cmd+D or shake for dev menu',
  android: 'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

export default class App extends Component<{}> {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit App.js
        </Text>
        <Text style={styles.instructions}>
          {instructions}
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

app.json

{
  "name": "hihi",
  "displayName": "hihi"
}

.babelrc

{
  "presets": ["react-native"]
}

package.json

{
    "name": "hihi",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "react": "16.0.0",
        "react-native": "0.50.3",
        "watchman": "^0.1.8"
    },
    "devDependencies": {
        "babel-jest": "21.2.0",
        "babel-polyfill": "^6.26.0",
        "babel-preset-es2015": "^6.24.1",
        "babel-preset-react-native": "4.0.0",
        "babel-register": "^6.26.0",
        "jest": "21.2.1",
        "react-test-renderer": "16.0.0"
    },
    "jest": {
        "preset": "react-native"
    }
}

, :

com.android.tools.build:gradle:3.0.0-alpha1 CI

google() , 8082 . !!!

+9
5

, :

  • , 8081: react-native start --port 8082 --reset-cache
  • react-native run-android --port 8082 .
  • Ctrl + M.
  • Dev Settings .
  • Debug server host & port for device.
  • localhost:8082 OK.
  • react-native run-android --port 8082
+17

, , 8081.

  1. lsof -i tcp:8081
  2. PID, 25120
  3. : kill -9 25120
  4. React Native
+1

( ), netstat win CMD ( ). : 8081, .

  1. .
  2. : 8081 Windows
  3. .
0

, , .

-, , :

$> netstat -aon|findstr "8081"

a) env Windows, RN:

$> SET RCT_METRO_PORT=8083

RN , , 8081

) :

$> adb reverse –remove-all

c) adb:

$> adb reverse tcp:8083 tcp:8083

d) 8081 8083.

Launch the application and then enter input keyevent 82, now select " Dev Settings"> "Debug Server ..."> enter the new URL: localhost: 8083.

build and run again

0
source

Try disabling local server programs such as MAMP, WAMP, OpenServer, etc. They can

0
source

Source: https://habr.com/ru/post/1689421/


All Articles