Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native packager fails to create jsbundle

Tags:

react-native

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!

like image 429
ggsrivas Avatar asked Sep 06 '17 01:09

ggsrivas


1 Answers

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.).

like image 128
ggsrivas Avatar answered Oct 11 '22 08:10

ggsrivas