react-native运行安卓报错。Error: Unable to resolve module `./index` from `\node_modules\react-native\scripts/.`
处理方法
"react": "^16.8.4", "react-native": "^0.59.0",
解决方法:
Though you will need to do this for every time you start a new project.. its an upgrade issue from react-native
Update node_modules\react-native\scripts\launchPackager.bat file. @echo off title Metro Bundler call .packager.bat
// delete this line
node "%~dp0..\cli.js" start
Add this line
node "%~dp0..\cli.js" start --projectRoot ../../../
pause
exit
We are giving project root path to Metro instance here,
Or in \node_modules@react-native-community\cli\build\commands\runAndroid\runAndroid.js edit this, const procConfig = {
// delete this line
cwd: scriptsDir
// add this line
cwd: process.cwd()
};
原文:https://blog.csdn.net/devilnov/article/details/88944063