5
votes

I just upgraded react-native version to 0.48.1 from 0.30 and I am facing a weird issue. I fixed all the peer-dependencies for the libraries that I am using. then ran command,

react-native start

running above command starts packager. Now when I hit below url to generate jsbundle, http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false

I am getting below error,

"message":"Ambiguous resolution: module '$PROJ_ROOT_DIR/index.android.js' tries to require 'react-native', but there are several files providing this module. You can delete or fix them: 
$PROJ_ROOT_DIR/node_modules/jest-react-native/node_modules/react-native/package.json
$PROJ_ROOT_DIR/node_modules/react-native/package.json"

$PROJ_ROOT_DIR is my project directory path.

I don't have any '$PROJ_ROOT_DIR/node_modules/jest-react-native/node_modules/' directory in my setup. I tried deleting node_modules directory then running npm install. but nothing changed.

I have also tried, clearing packager cache by running command,

ls -l $TMPDIR/react-*

but nothing happened.

Has anyone faced similar issue? any suggestions?

Thanks in advance!

1
Please post your package.json file here. - Manvendra SK
Moreover why this command react-native start? - Manvendra SK
My bad. Yes it was a caching issue. npm start -- --reset-cache solved the issue. packager.sh file location changed RN 0.48 so my setup was not able to locate packager.sh file and npm start was not working. I assumed that react-native start and npm start might be same. But they are not. - ggsrivas
I have been using react-native start -- --reset-cache and nothing was happening. wasted few hours. :( - ggsrivas
So is it working or not? - Manvendra SK

1 Answers

5
votes

In case anyone else facing same issue of similar issues, Clearing cache using below command worked for me.

npm start -- --reset-cache

I was trying react-native start -- --reset-cache command which does nothing(my bad.).