相关疑难解决方法(0)

纱线工作区中的 React Native 不解析外部包

我正在使用纱线工作区为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)

react-native redux react-redux monorepo yarn-workspaces

4
推荐指数
1
解决办法
3546
查看次数