Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate module name: react-native #129

Closed
sjenit opened this issue Oct 7, 2018 · 27 comments
Closed

Duplicate module name: react-native #129

sjenit opened this issue Oct 7, 2018 · 27 comments

Comments

@sjenit
Copy link

sjenit commented Oct 7, 2018

Loading dependency graph...(node:13752) UnhandledPromiseRejectionWarning: Error: jest-haste-map: @providesModule naming collision:
  Duplicate module name: react-native
  Paths: E:\my_project\node_modules\react-native-razorpay\node_modules\react-native\package.json collides with E:\my_project\node_modules\react-native\package.json

This error is caused by a @providesModule declaration with the same name across two different files.
    at setModule (E:\my_project\node_modules\metro\node_modules\jest-haste-map\build\index.js:462:17)
    at workerReply (E:\my_project\node_modules\metro\node_modules\jest-haste-map\build\index.js:512:9)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
(node:13752) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:13752) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:13752) UnhandledPromiseRejectionWarning: Error: jest-haste-map: @providesModule naming collision:
  Duplicate module name: react-native
  Paths: E:\my_project\node_modules\react-native-razorpay\node_modules\react-native\package.json collides with E:\my_project\node_modules\react-native\package.json

This error is caused by a @providesModule declaration with the same name across two different files.
    at setModule (E:\my_project\node_modules\metro\node_modules\jest-haste-map\build\index.js:462:17)
    at workerReply (E:\my_project\node_modules\metro\node_modules\jest-haste-map\build\index.js:512:9)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
(node:13752) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

Getting above error after upgrading to latest version (2.0.13) of the package.
clean and npm --reset-cache already tried but didn't work.

Issue is quite similar to:
#93
#42

@iThink32
Copy link
Contributor

iThink32 commented Oct 8, 2018

@sjenit this is due to a derived data issue , I request you to delete it and try again , moreover if you look closely at our package we do not have a node modules folder anymore.
Try deleting react-native-razorpay from your node modules folder and run npm install.

@sjenit
Copy link
Author

sjenit commented Oct 8, 2018

@iThink32 Issue still persists. I tried deleting react-native-razorpay and running npm install.
Also, I can see node_modules folder inside react-native-razorpay package. Please let me know if i am missing anything. It is working absolutely fine when I downgrade to the older version 2.0.10.

@Balasnest
Copy link

Balasnest commented Oct 9, 2018

@iThink32 There is no one time fix for this problem. Its keep arising whenever do npm install. We need to repeat the step again and again to resolve.

rm -rf ./node_modules && npm install
npm cache clean
npm start -- --reset-cache

After doing this, most of the time node_modules appear again.
@sjenit Currently what you can do it, when your project runs/resolved, immediately copy the react-native-razorpay from node_modules and keep it seperately. When this issue arise replace the package. That is how I resolved it temporarily.

@iThink32
Copy link
Contributor

iThink32 commented Oct 9, 2018

@Balasnest its a react-native issue , I told you in the beginning itself react-native is not at all stable for Xcode 10 , coming to our package as I mentioned we do not ship node_modules , you can have a look at the new package yourself.

@amrita019
Copy link

I just deleted the node module folder from react-native-razorpay, it worked for me, maybe will work for you too.

@iThink32
Copy link
Contributor

@amrita019 our latest framework does not contain a node modules folder , please check our latest framework carefully.

@iThink32
Copy link
Contributor

closing due to inactivity.

@Balasnest
Copy link

@iThink32 will that latest framework works in react-native: 0.56 and Xcode: 9.3 | 9.4 ? Which is stable one for 0.56?

@iThink32
Copy link
Contributor

@Balasnest please reopen issues before commenting.Anyway our latest framework will only work on Xcode 10 , react-native i.e 0.57.1 ,react version 16.5.0 and above.

@iThink32 iThink32 reopened this Oct 11, 2018
@salujaharkirat
Copy link

salujaharkirat commented Oct 11, 2018

@iThink32 if I remove the react-native folder inside react-native-razorpay it works fine in development mode but while creating a production build in android, I am getting following error:-

> Could not list contents of '/Users/harkirat/wealthy/bumblebee-new/node_modules/react-native-razorpay/node_modules/.bin/react-native'. Couldn't follow symbolic link.

react-native 0.57.2
react 16.5.0
react-native-razorpay 2.0.14

Pleas help?

@Balasnest
Copy link

@jinxac Try removing react-native-razorpay/node_modules/ and project/node_modules/.bin/ folder

@iThink32
Copy link
Contributor

iThink32 commented Oct 12, 2018

@jinxac no this is not a good fix , it is working fine for me ,try the example on this repo on a separate folder.React-native is unstable for Xcode 10 , delete derived data , stop your metro bundler instance and try again.Also google for alternative solutions.
@Balasnest our latest package does not have a node modules folder , if you see a node modules folder in react-native-razorpay you are using an old version.

@iThink32
Copy link
Contributor

closing due to inactivity.

@paddy57
Copy link

paddy57 commented Oct 29, 2018

I'm getting the same error, how can i resolve it.
Duplicate module name: react-animated

@salujaharkirat
Copy link

remove node_modules/react-native-razorpay/node_modules/react-native @paddy57

@paddy57
Copy link

paddy57 commented Oct 29, 2018

that just one time fix, next time if i do npm install the node module folder will regenerate again @jinxac

@Balasnest
Copy link

@paddy57 Try blacklisting the directory.
how-to-make-react-native-packager-ignore-certain-directories

@iThink32
Copy link
Contributor

@paddy57 yes blacklisting is the right way forward but pls analyse the directories that you are blacklisting.

@ashutoshshubam
Copy link

use "react-native-razorpay": "https://github.com/ashutoshshubam/react-native-razorpay",
its working. In package.json file

@iThink32
Copy link
Contributor

@ashutoshshubam I appreciate that you have forked react-native-razorpay and are trying to help but in such a case a user following your advice will not be able to run npm update and get the latest updates from us , it would be better if you could post your solution instead and give your repo's link as a reference to it.

@ashutoshshubam
Copy link

@iThink32 actually its not possible without forking because react-native-razorpay is using react-native": "0.57.1 and they have both have their own package.json so when ever you run npm install it will give error at run time so can you tell me a better way to do that.

@iThink32
Copy link
Contributor

@ashutoshshubam what error are you facing? If it is an ambiguous reference issue then blacklist the conflicting directory , that's what I did.

@ashutoshshubam
Copy link

@iThink32 can you share you repo or some link.

@iThink32
Copy link
Contributor

@ashutoshshubam you will easily get references regarding blacklisting , anyway I've just found one now
https://stackoverflow.com/questions/41813211/how-to-make-react-native-packager-ignore-certain-directories

The example folder of this repo contains a file called rn-cli.config.js in which I have blacklisted a particular directory.You can see that for reference.

@hsnMoghadasi
Copy link

it's work for me
amazon-archives/awsmobile-cli#172 (comment)

@erkrujjawal786
Copy link

Non of the solution fixes my error. I have the same error.

@ashutoshshubam
Copy link

@erkrujjawal786, for now, use this:-"react-native-razorpay": "https://github.com/ashutoshshubam/react-native-razorpay",
its working. In package.json file.
once the library is stable then replace it with the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants