我刚刚将 react-native 版本从 0.30 升级到 0.48.1,我面临一个奇怪的问题。我修复了我正在使用的库的所有对等依赖项。然后运行命令,
反应本机开始
运行上面的命令启动打包程序。现在,当我点击下面的 url 生成 jsbundle 时, http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false
我得到以下错误,
"message":"Ambiguous resolution: module '$PROJ_ROOT_DIR/index.android.js' tries to require 'react-native', but there are several files providing this module. You can delete or fix them:
$PROJ_ROOT_DIR/node_modules/jest-react-native/node_modules/react-native/package.json
$PROJ_ROOT_DIR/node_modules/react-native/package.json"
Run Code Online (Sandbox Code Playgroud)
$PROJ_ROOT_DIR 是我的项目目录路径。
我的设置中没有任何“$PROJ_ROOT_DIR/node_modules/jest-react-native/node_modules/”目录。我尝试删除 node_modules 目录,然后运行 npm install。但什么都没有改变。
我也试过,通过运行命令清除打包程序缓存,
ls -l $TMPDIR/反应-*
但什么也没发生。
有没有人遇到过类似的问题?有什么建议?
提前致谢!
如果其他人遇到类似问题的相同问题,使用以下命令清除缓存对我有用。
npm start -- --reset-cache
我正在尝试react-native start -- --reset-cache什么都不做的命令(我的错。)。
| 归档时间: |
|
| 查看次数: |
2388 次 |
| 最近记录: |