【问题标题】:I am getting "Unable to resolve module `react我收到“无法解析模块`react
【发布时间】:2017-04-09 07:09:58
【问题描述】:

我收到以下错误。

开发服务器返回响应错误码: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..

【问题讨论】:

  • 我可以看看你的 index.android.js 吗?

标签: react-native


【解决方案1】:

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

停止服务器并重新安装'react'

 npm install react --save

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

 npm start --reset-cache

然后运行你的应用程序

【讨论】:

    【解决方案2】:

    试试

    npm install
    

    希望这能解决

    【讨论】:

      【解决方案3】:

      节点模块有问题,我必须 remove the node moduleadd 然后我不得不降级 React-Native 库并运行命令 react-native start 然后 react-native run-android 之后它对我有用.

      【讨论】:

        猜你喜欢
        • 2018-03-05
        • 2018-09-21
        • 2017-10-11
        • 2017-07-23
        • 2016-03-23
        • 1970-01-01
        • 2021-11-03
        • 1970-01-01
        • 2023-03-22
        相关资源
        最近更新 更多