oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.31k stars 2.12k forks source link

Invariant Violation: expected workspace package to exist for 'react-native' when installing in a monorepo #1621

Closed aureliopetrone closed 1 month ago

aureliopetrone commented 1 month ago

Environment

OS: Mac OS 13.0 / node v20.13.1 react-native-vector-icons version: latest React Native version: 0.73.6 Yarn version: 1.22

Description

I am encountering the following error when trying to use react-native in my monorepo setup:

Invariant Violation: expected workspace package to exist for 'react-native'

I have verified that react-native is correctly listed in the dependencies of the root package.json. I have also checked the following:

Despite these checks, the issue persists.

Here is my package.json:


{
  "name": "mono",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {},
  "private": true,
  "devDependencies": {
    "@babel/core": "^7.14.5",
    "@babel/preset-react": "^7.14.5",
    "@nx/devkit": "19.0.4",
    "@nx/eslint": "19.0.4",
    "@nx/eslint-plugin": "19.0.4",
    "@nx/jest": "19.0.4",
    "@nx/js": "19.0.4",
    "@nx/node": "19.0.4",
    "@nx/playwright": "19.0.4",
    "@nx/react": "^19.0.4",
    "@nx/react-native": "^19.0.4",
    "@nx/web": "19.0.4",
    "@nx/webpack": "19.0.4",
    "@playwright/test": "^1.36.0",
    "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
    "@react-native-community/cli-platform-android": "~12.3.6",
    "@react-native/babel-preset": "^0.73.21",
    "@react-native/metro-config": "^0.73.5",
    "@simondotm/nx-firebase": "^2.3.0",
    "@svgr/webpack": "^8.0.1",
    "@swc-node/register": "~1.8.0",
    "@swc/cli": "~0.3.12",
    "@swc/core": "~1.3.85",
    "@swc/helpers": "~0.5.2",
    "@testing-library/jest-native": "~5.4.3",
    "@testing-library/react": "15.0.6",
    "@testing-library/react-native": "^12.5.0",
    "@types/jest": "^29.4.0",
    "@types/node": "18.16.9",
    "@types/react": "18.3.1",
    "@types/react-dom": "18.3.0",
    "@typescript-eslint/eslint-plugin": "^7.3.0",
    "@typescript-eslint/parser": "^7.3.0",
    "babel-jest": "^29.4.1",
    "eslint": "~8.57.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-import": "2.27.5",
    "eslint-plugin-jsx-a11y": "6.7.1",
    "eslint-plugin-playwright": "^0.15.3",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-hooks": "4.6.0",
    "firebase-functions-test": "^3.1.1",
    "firebase-tools": "^12.9.1",
    "jest": "^29.4.1",
    "jest-environment-jsdom": "^29.4.1",
    "jest-environment-node": "^29.4.1",
    "jest-react-native": "18.0.0",
    "kill-port": "^2.0.1",
    "nx": "19.0.4",
    "prettier": "^2.6.2",
    "react-native-svg": "15.1.0",
    "react-native-svg-transformer": "1.3.0",
    "react-native-web": "^0.19.10",
    "react-refresh": "^0.10.0",
    "react-test-renderer": "18.2.0",
    "ts-jest": "^29.1.0",
    "ts-node": "10.9.1",
    "typescript": "~5.4.2",
    "webpack-cli": "^5.1.4"
  },
  "workspaces": [
    "packages/*"
  ],
  "dependencies": {
    "firebase": "^10.10.0",
    "firebase-admin": "^11.11.1",
    "firebase-functions": "^4.8.2",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "react-native": "0.73.6",
    "tslib": "^2.3.0"
  }
}
aureliopetrone commented 1 month ago

Switching to Yarn 2 solves the problem.