macos - µWebSockets 的 React Native OSX CRNA 编译未能通过 C++11 编译器

标签 macos c++11 react-native expo create-react-native-app

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

Origin: Worker (PID 6336) 12:18:06: [Error] Error: getaddrinfo ENOTFOUND lcalhost 12:18:06: at errnoException (dns.js:28:10) 12:18:06: at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

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

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'.

package.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"
  }
}

app.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
  }
}

最佳答案

@SyedZainAli提到这可能是环境造成的。然后要尝试的一些事情是:

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

就我而言,弹出并使用Expo React-native分支(默认行为)会导致问题。改回官方的react-native npm 包可以解决该问题。所以应该是世博会方面的事情。

关于macos - µWebSockets 的 React Native OSX CRNA 编译未能通过 C++11 编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48128275/

相关文章:

python - 如何在 MacOS 上使用 QGLFormat 更改 OpenGL 版本?

macos - 某些键映射在 MacVim 中不起作用

c# - 在 Mac 上运行浏览器外的 Silverlight 应用程序需要什么?

C++11 static_assert 和模板实例化

javascript - 突出显示 FlatList 中的搜索文本 - React Native

objective-c - dispatch_after() 的奇怪行为

c++ - 'A(tmpVector);' 与 'A tmpVector;' 有什么区别?

c++ - 当在 vector 上使用调整大小时, vector 内部结构中的 unique_ptr 不会编译

module - ReactNative - 未定义不是一个对象(评估 x)

javascript - 设置 ReactJS 环境