我收到“无法解析模块`反应
问题描述:
我得到下面的错误我收到“无法解析模块`反应
开发服务器返回的响应错误代码: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..
答
有与节点模块一个问题,我必须remove the node module
和add
然后我不得不降级React-Native库并运行命令react-native start
,然后react-native run-android
后它为我工作
答
检查是否命名反应的文件夹内部存在node_modules命名的文件夹或没有,如果它不存在的话,
安装后停止服务器,并重新安装“反应”
npm install react --save
请正在重置的重新启动服务器缓存
npm start --reset-cache
然后运行你的应用程序
可我看见你的index.android.js? – Codesingh