React Native Expo Nativewind Android failed to deserialize; expected an object-like struct named Specifier, found ()
For Expo 58 and Nativewind v5.0.0-rc.0, this problem persists after following the Nativewind doc at https://www.nativewind.dev/v5/getting-started/installation
lightningcss version seems to be the problem. Pnpm seems not be able to lock it down to 1.30.1.
The Nativewind doc has an error at "5. Override the lightningcss version".
The '"pnpm": {}' does not work for the latest pnpm 12.15.0
The solution for pnpm, add the following into your package.json
"devDependencies": {"lightningcss": "1.30.1"},
"resolutions": {"lightningcss": "1.30.1"},
"overrides": {"lightningcss": "1.30.1"},
Notice: `"lightningcss": "1.30.1"` should already exist in the `devDependencies` section after running this command from the doc: `pnpm add --save-dev --save-exact tailwindcss@4.1.12 @tailwindcss/postcss@4.1.12 postcss lightningcss@1.30.1`
Reinstall all packages:
rm pnpm-lock.yaml; rm -rf node_modules
pnpm install
npx expo start -c
in tsconfig.json
add this under "compilerOptions": "jsx": "react-native",
add this under "include": "nativewind-env.d.ts",
For unknown reasons, pnpm may drop your packages.
For example: I saw "cannot find module nativewind metro"
So you need to install them back again:
pnpm add --save-exact nativewind@5.0.0-rc.0 react-native-css@3.1.0-rc.0
pnpm add --save-dev --save-exact tailwindcss@4.1.12 @tailwindcss/postcss@4.1.12 postcss lightningcss@1.30.1
pnpm add expo
Russo