我正在使用纱线工作区为react
和创建 monorepo react-native
。我尝试添加redux
到@app/common
并且它可以很好地使用react
,但它无法在本机中解析。您可以在https://github.com/Faisal-Manzer/react-and-react-native-monorepo/tree/08-redux上查看源代码。
加载捆绑包时出现以下错误。
error: Error: Unable to resolve module `redux` from `../common/reducers/index.js`: redux could not be found within the project or in these directories:
../../node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
at ModuleResolver.resolveDependency (/Users/user/monorepo/packages/native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15) …
Run Code Online (Sandbox Code Playgroud)