microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.25k stars 1.14k forks source link

Folly compiler error causing build to fail #11158

Closed ransfordnyarko closed 1 year ago

ransfordnyarko commented 1 year ago

Problem Description

react-native run-windows fails to build Original build on windows 11 works fine but on windows 10 it returns this error Run with visual studio code

Error message: Building Solution: C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\XamlCompiler\Microsoft.Windows.UI.X... × Build failed with message C:\Users\Larkuo\Documents\Work\El-Parah\Code\storeWindows\store\node_modules.folly\folly-2021.06.28.00\folly\lang\Assume.cpp(26,3): error C2131: expression did not evaluate to a constant [C:\Users\Larkuo\Documents\Work\El-Parah\Code\storeWindows\store\node_modules\react-native-windows\Folly\Folly.vcxproj]. Check your build configuration.

Steps To Reproduce

  1. npx react-native-windows-init --overwrite
  2. npm run windows

Expected Results

That the app deploys

CLI version

npx react-native --version

Environment

"name": "store",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "windows": "react-native run-windows"
  },
  "dependencies": {
    "@emmanuj/react-native-fast-toast": "^2.1.4",
    "@nozbe/watermelondb": "^0.24.0",
    "@react-native-async-storage/async-storage": "^1.17.11",
    "@react-native-community/checkbox": "^0.5.14",
    "@react-native-community/netinfo": "^9.3.7",
    "@react-navigation/drawer": "^6.5.7",
    "@react-navigation/native": "^6.1.2",
    "@react-navigation/native-stack": "^6.9.8",
    "@react-navigation/stack": "^6.3.11",
    "@twotalltotems/react-native-otp-input": "^1.3.11",
    "date-fns": "^2.29.3",
    "i18next": "^22.4.9",
    "jwt-decode": "^3.1.2",
    "libphonenumber-js": "^1.10.18",
    "material-bread": "^0.2.10",
    "numbro": "^2.3.6",
    "ramda": "^0.27.1",
    "react": "18.1.0",
    "react-dom": "^18.2.0",
    "react-i18next": "^12.1.4",
    "react-native": "^0.68.0",
    "react-native-country-picker-modal": "^2.0.0",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-get-random-values": "^1.8.0",
    "react-native-google-places-autocomplete": "^2.5.1",
    "react-native-localize": "^2.2.4",
    "react-native-paper": "^4.12.5",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-reanimated": "^1.10.0",
    "react-native-safe-area-context": "^4.5.0",
    "react-native-screens": "^3.19.0",
    "react-native-svg": "^12.5.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "^0.18.12",
    "react-native-windows": "0.68.26",
    "rxjs": "^7.8.0",
    "underscore": "^1.13.6",
    "uuid": "^9.0.0",
    "validate.js": "^0.13.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/plugin-proposal-decorators": "^7.20.13",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^26.0.23",
    "@types/ramda": "^0.28.22",
    "@types/react": "^18.0.21",
    "@types/react-native": "^0.70.6",
    "@types/react-native-vector-icons": "^6.4.13",
    "@types/react-test-renderer": "^18.0.0",
    "@types/underscore": "^1.11.4",
    "@types/uuid": "^9.0.0",
    "@typescript-eslint/eslint-plugin": "^5.37.0",
    "@typescript-eslint/parser": "^5.37.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-config": "^0.72.3",
    "metro-react-native-babel-preset": "0.72.3",
    "npm-force-resolutions": "0.0.10",
    "react-test-renderer": "18.1.0",
    "typescript": "^4.8.3"
  },
  "resolutions": {
    "react-native-vector-icons": "^9.2.0"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }

Target Platform Version

10.0.19041

Target Device(s)

Desktop

Visual Studio Version

None

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

No response

ransfordnyarko commented 1 year ago

Found the solution to this issue just in case someone faces this in the future. Update your visual studio to 16.11.23

acoates-ms commented 1 year ago

Sounds like this has a resolution.