Error when using with metro only
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 40/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- javascript, react-native
- Área
- build-system, tooling
Línea de trabajo
Start with the metro.config.js from the linked example repository and reproduce the 'Cannot find module expo/package.json' error by running npm run start. The stack trace points to node_modules/@expo/metro-config/build/transform-worker/utils/moduleMapper.js, so read how that file resolves modules and why it needs expo/package.json. Done means Metro loads a config built from @expo/metro-config without installing the full expo package, or the README is corrected to say otherwise.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Before submitting a new issue
- I tested using the latest version of the library, as the bug might be already fixed.
- I tested using a supported version of react native.
- I checked for possible duplicate issues, with possible answers.
Bug summary
The instructions in the README.md state:
Non-Expo Projects
react-native-css relies on the bundler to process CSS files. Currently only Expo provides a CSS asset pipeline. Since the Expo SDK is modular, you can add this functionality by just using the @expo/metro-config package.
Follow the Expo instructions, but replace the expo package with @expo/metro-config.
When I try this I receive an error:
error Error loading Metro config at: metro.config.js
Cannot find module 'expo/package.json'
Require stack:
- node_modules/@expo/metro-config/build/transform-worker/utils/moduleMapper.js
Is there a specific version of @expo/metro-config I should be using? I'd like to avoid importing all of expo.
Library version
3.0.7
Environment info
System:
OS: Linux 7.0
CPU:
Memory: GB
Shell:
version: 5
path: /bin/sh
Binaries:
Node:
version: 24.15.0
path:
Yarn:
version: 1.22.22
path:
npm:
version: 11.13.0
path:
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.19
path:
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 20.1.3
wanted: ^20.1.3
react:
installed: 19.2.3
wanted: ^19.2.5
react-native:
installed: 0.85.3
wanted: ^0.85.3
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Steps to reproduce
npx @react-native-community/cli@latest init reactNativeCssExample --version latestnpm i --save-dev react-native-css @expo/metro-config- setup
metro.config.js
const { mergeConfig } = require('@react-native/metro-config');
const { getDefaultConfig } = require('@expo/metro-config');
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('@react-native/metro-config').MetroConfig}
*/
const config = {};
module.exports = mergeConfig(
getDefaultConfig(__dirname),
config
);
npm run start
Reproducible example repository
- Lenguaje dominante
- TypeScript
- Estrellas
- 166
- Forks
- 45
- Merge medio
- 13 d 14 h
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nativewind/react-native-css
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nativewind/react-native-css#545 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nativewind/react-native-css#544 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nativewind/react-native-css#543 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
nativewind/react-native-css#540 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nativewind/react-native-css#538 ·
Los mantenedores suelen responder en 3 días
Todos los issues de nativewind/react-native-css
Issues similares
-
bug ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
PhyberApex/kuroshiro#1687 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
microsoft/monaco-editor#5563 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
awslabs/visual-asset-management-system#937 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100