react-native - 我得到 "Unable to resolve module ` react

标签 react-native

enter image description here我收到以下错误。

开发服务器返回响应错误码:500

URL: http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false

Body:
{"from":"D:\AwesomeProject\index.android.js","to":"react","message":"Unable to resolve module react from D:\\AwesomeProject\\index.android.js: Module does not exist in the module map or in these directories:\n D:\AwesomeProject\node_modules\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start --reset-cache.","name":"UnableToResolveError","type":"UnableToResolveError","errors":[{}]}
onResponse
DevServerHelper.java:332
execute
RealCall.java:126
run
NamedRunnable.java:32
runWorker
ThreadPoolExecutor.java:1112
run
ThreadPoolExecutor.java:587
run
Thread.java:818

{"from":":\\AwesomeProject\\index.android.js","to":"react","message":"Unable to resolve module `react`
i tried every workaround given by the log still it's not working..

最佳答案

检查名为 react 的文件夹是否存在于名为 node_modules 的文件夹中,如果不存在,则

停止服务器并再次安装'react'

 npm install react --save

安装完成后请通过重置缓存重启服务器

 npm start --reset-cache

然后运行你的应用

关于react-native - 我得到 "Unable to resolve module ` react ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43304012/

相关文章:

react-native - 将导航启动画面 react 到登录屏幕

react-native - 设置 React Native ListView 的初始滚动位置

javascript - 如何创建动态SectionList?

react-native - 如何删除 React Native Text 组件下不需要的填充?

xcode - pod 安装错误 : The name of the given podspec `Yoga` doesn't match the expected one `yoga`

reactjs - 在 native react 中检测 View 外部的点击

reactjs - React - 将组件作为参数传递给另一个组件

android - 在 Native Base 上打开键盘时如何避免双击?

javascript - 在 native 选择器中禁用 Picker.item

javascript - 图片未出现在应用程序的 "release version"中