Error: Unable to resolve module `./index` from `\node_modules\react-native\scripts/.`

1088 단어 RN
Error: Unable to resolve module  ./index  from 
ode_modules\react-native\scripts/.
: The module  ./index  could not be found from 
ode_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 ode_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()
};

좋은 웹페이지 즐겨찾기