-
Notifications
You must be signed in to change notification settings - Fork 181
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
ERROR: Duplicate module name: sample-node-project #120
Comments
Hi @aerielcruz , Thank you for reporting this. This is caused by the react-native bundler finding duplicate files from the nodejs-project, as these are copied by the build process to be included in the application's assets, though it used to be a warning. You can add the conflicting paths to the bundler blacklist by adding a
Here's an example from the file inside a sample: https://github.com/janeasystems/nodejs-mobile-samples/blob/dd008acf75f3202ee4ab64b3822ab4bfa6e6f965/react-native/UseMultipleChannels/rn-cli.config.js Please let us know if this change allows your application to build. |
Hi @aerielcruz ,
|
Thanks for the follow-up @jaimecbernardo ! I also tried it on my existing Might give an update when adding new packages. Again thanks! 😄 |
Thank you for the feedback. Instructions to trouble shoot this have been added to the README.md, as well: https://github.com/janeasystems/nodejs-mobile-react-native/tree/ed727edea17e8a9e1a85cef3413becc83b8a0328#duplicate-module-name |
Hi @jaimecbernardo jaimecbernardo I still have the error and cannot start the server. Here is the log: Loading dependency graph...jest-haste-map: Haste module naming collision: sample-node-project Failed to construct transformer: { Error: Duplicated files or mocks. Please check the console for more info |
I'm having this issue as well. |
the issue still exist |
For the new versions of react-native (+0.60) you have to modify the metro-config.js file, just add the resolver: const blacklist = require('metro-config/src/defaults/blacklist');
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
module.exports = {
resolver:{
blacklistRE: blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
])
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
}; |
For me i need to use |
React Native - Duplicate Module Name Error
Im trying to implement js-ipfs-api to my RN app but it requires Node.js v6 or higher but this problem I can't even get through.
Metro Bundler has encountered and internal error, please check your terminal error output for more details
This error showed after running
react-native run-android
in mycreate-react-native-app
and made a separatereact-native init
project to test the error.NDK is installed as well as CMAKE and my SDK and NDK directory are in my local.properties.
To reproduce issue:
react-native init TestProject
(or you may try
$ create-react-native-app
if there could be a difference)cd TestProject
npm install nodejs-mobile-react-native --save
react-native link nodejs-mobile-react-native
export ANDROID_HOME=/Users/username/Library/Android/sdk
export ANDROID_NDK_HOME=/Users/username/Library/Android/sdk/ndk-bundle
(I've installed NDK in Android Studio's SDK Manager)react-native run-android
to testnodejs-assets/nodejs-project/
path and renamesample-main.js
tomain.js
andsample-package.json
topackage.json
react-native run-android
and check your Metro Bundler, you may or may not see an error jest-haste-map: @providesModule naming collision: ... but it still ran so there shouldn't be a problem right?? Haha nopereact-native run-android
againI've already looked into this Runtime Support: React-Native #1254 and done a ton of googling in terms of this issue but there aren't a lot of examples or issues with the use of
nodejs-mobile-react-native
.This may be an unstable build but as of now this is the only option to implement nodejs in RN so I get to interact with IPFS.
The text was updated successfully, but these errors were encountered: