Error: Unable to resolve module ./index
from \node_modules\react-native\scripts/.
: The module ./index
could not be found from \node_modules\react-native\scripts/.
. Indeed, none of these files exist:
"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()
};