2

从 Expo(使用 ExpoKit)弹出后出现此问题。在弹出之前有一个工作环境。npm run ios将一遍又一遍地重复这个问题:

来源:工人(PID 6336)12:18:06:[错误]错误:getaddrinfo ENOTFOUND lcalhost 12:18:06:在 errnoException(dns.js:28:10)12:18:06:在 GetAddrInfoReqWrap.onlookup [as完成] (dns.js:76:26)

Expo XDE 根本不会运行并重复此消息。XCode 包含 C++11 编译器。

错误:µWebSockets 的编译失败,并且没有可用于您的系统的预编译二进制文件。请安装支持的 C++11 编译器并重新安装模块“uws”。

包.json

{
  "name": "OurApp",
  "version": "0.0.1",
  "private": true,
  "devDependencies": {
    "babel-eslint": "^8.0.3",
    "eslint": "^4.13.1",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.5.1",
    "jest-expo": "^23.0.0",
    "react-native-scripts": "1.8.1",
    "react-test-renderer": "16.0.0",
    "remotedev-rn-debugger": "^0.8.3"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch",
    "postinstall": "remotedev-debugger --hostname lcalhost --port 5678 --injectserver",
    "eslint": "./node_modules/.bin/eslint"
  },
  "remotedev": {
    "hostname": "localhost",
    "port": 5678
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^6.2.1",
    "axios": "^0.17.1",
    "expo": "^23.0.0",
    "lodash": "^4.17.4",
    "prop-types": "^15.6.0",
    "react": "16.0.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-23.0.0.tar.gz",
    "react-native-elements": "^0.18.5",
    "react-native-maps": "^0.19.0",
    "react-navigation": "^1.0.0-beta.19",
    "react-navigation-redux": "^0.1.0",
    "react-redux": "^5.0.6",
    "redux": "^3.7.2",
    "redux-logger": "^3.0.6",
    "redux-promise": "^0.5.3",
    "redux-thunk": "^2.2.0",
    "remote-redux-devtools": "^0.5.12"
  }
}

应用程序.json

{
  "expo": {
    "isDetached": false,
    "privacy": "unlisted",
    "sdkVersion": "23.0.0",
    "orientation": "portrait",
    "primaryColor": "#ffde00",
    "name": "OurApp",
    "description": "Desc",
    "icon": "./resources/icon.png",
    "version": "0.0.1",
    "slug": "our-app",
    "scheme": "ourapp",
    "ios": {
      "bundleIdentifier": "se.comp.expo",
      "config": {
        "googleMapsApiKey": "key"
      },
      "buildNumber": "1.0.0",
      "isRemoteJSEnabled": true,
      "supportsTablet": false,
      "associatedDomains": [
        "myDomain.com"
      ]
    },
    "android": {
      "package": "se.comp.expo",
      "versionCode": 1,
      "config": {
        "googleMaps": {
          "apiKey": "key"
        }
      },
      "permissions": [
        "CAMERA",
        "ACCESS_FINE_LOCATION"
      ]
    },
    "notification": {
      "icon": "./resources/icon_notify.png",
      "color": "#ffde00",
      "androidMode": "collapse",
      "androidCollapsedTitle": "#{unread_notifications} new"
    },
    "loading": {
      "icon": "./resources/icon.png",
      "backgroundColor": "#000000",
      "backgroundImage": "./resources/splash.png",
      "hideExponentText": true
    },
    "splash": {
      "backgroundColor": "#000000",
      "image": "./resources/splash.png",
      "resizeMode": "cover"
    },
    "androidStatusBar": {
      "barStyle": "dark-content",
      "backgroundColor": "#ffde00"
    },
    "facebookAppId": "id",
    "facebookDisplayName": "OurApp",
    "facebookScheme": "fbId",
    "androidShowExponentNotificationInShellApp": true
  }
}
4

3 回答 3

2

正如@SyedZainAli提到的,这可能是由环境引起的。然后要尝试的几件事是:

  • 删除 node_modules,运行npm cache clean并重新安装
  • 重新安装 NodeJS
  • 使用 CRNA 创建新应用并进行比较

在我的情况下,弹出和使用Expo react-native 分支(默认行为)会导致问题。改回官方的 react-native npm 包解决了这个问题。所以应该是世博会的事情。

于 2018-01-08T18:10:46.207 回答
0

我不知道这是否对您有帮助,但它解决了我在 docker 中的问题。

在 Docker 文件中

///////////////////////////////////////// //////////////////////

FROM node:8.9-alpine

RUN apk add --update \ libc6-compat

///////////////////////////////////////// //////////////////////

需要libc6-compact

所以尝试安装libc6-compat.

于 2018-01-19T21:03:23.263 回答
0

当我尝试启动从我的 Expo 团队获得的应用程序时,我遇到了同样的问题(如下)。结果发现uws项目中的版本与我使用的 Node 版本不兼容。- 节点 v10.15.0

将节点版本切换为8.11.4使用 nvm -nvm use 8.11.4解决了我的问题。(如果没有安装 8.11.4 版本,请nvm install 8.11.4改用)

$ expo start
Starting project at /Users/dugong/development/myApp
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
oteDev] Start server...
--------------------------------------------------------------------------------
[Busy] Launching SocketCluster
1555352786943 - Origin: Worker (PID 63541)
[Error] Error: Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system. Please install a supported C++11 compiler and reinstall the module 'uws'.
at native (/Users/dugong/development/myApp/node_modules/socketcluster-server/node_modules/uws/uws.js:38:19)
于 2019-04-23T15:18:53.057 回答