awsmobile-cli
awsmobile-cli copied to clipboard
jest-haste-map: @providesModule naming collision: Duplicate module name
Hello,
Trying to run npm start on my project is now giving me the following error:
Error: jest-haste-map: @providesModule naming collision: Duplicate module name: app Paths: /Users/c2p1/apps/awsmobilejs/#current-backend-info/cloud-api/Table/package.json collides with /Users/c2p1/apps/awsmobilejs/backend/cloud-api/Table/package.json
both of these package.json are identical and have the field:
"name": "app"
I am now currently unable to build and run my app due to this.
Whenever I use the command awsmobile pull
I enter Yes to the question
Sync corresponding contents in backend/ with #current-backend-info/
and it to me it appears like this is where the issue is created. Should I not be syncing the contents? How do I fix this so I can build my project?
Thanks!
The contents in the #current-backend-info
folder and the backend
folder are pretty much the same after each synchronization with the cloud.
Then you develop your work in the backend
and push the changes up to the cloud.
That's the reason you see the two packages named the same.
Jest is a unit test framework, it's not part of the awsmobile-cli.
I'd suggest you to exclude the #current-backend-info
folder from being tested by jest-haste-map, and you should be able to build your project fine.
Thanks for your reply!
I know that this used to be fine, as I've had no problems before, but since upgrading to react-native 0.56.0 this issue has started happening. Right now, I currently can't find how to exclude the #current-backend-info
from the jest-haste-map. I will keep looking into it, but it seems odd that to be able to use awsmobile I then have to manually exclude some of the files it installs.
On the topic of awsmobile, is there any reason my project needs awsmobile folders prepended by a '~'? Can these be deleted?
awsmobile folders with name prefix '~' are backups, awsmobile-cli does not want you to loose your files, so if the cli is creating the contents in the awsmobilejs folder anew, it backs up the original contents in the backup folders. If you don't need those files, you can delete them, the cli doesn't use them.
Hi,
I am also running into the same problem but instead i have the package.json colliding with two different tables on my Cloud-api folder
This is my folder hierarchy
any ideas on how to fix this? Thank you
Hi @juang97, did this issue start being a problem after you had run a npm install
or npm audit fix
?
@UnleashedMind, if I delete #current-backend-info
will things still work? I have yet to find a way to exclude it from Jest-Haste-Map and this is preventing my app from running.
Next time when I do an
awsmobile pull
and say yes to sync info, will I then get a new #current-backend-info folder created? I
@C2P1. I was able to patch this issue by blacklisting the Table name under the awsmobile folder. This approach doesnt exactly fix the problem but everything is working as expected for me. If you are interested, take a look here https://stackoverflow.com/questions/41813211/how-to-make-react-native-packager-ignore-certain-directories
I'm having this exact same problem. I was just about to post and ask a question about it... but it's here already.
(node:90796) UnhandledPromiseRejectionWarning: Error: jest-haste-map: @providesModule naming collision: Duplicate module name: app Paths: /Users/mjc128/Desktop/ReactNativeKoalaCall/awsmobilejs/backend/cloud-api/globalSettings/package.json collides with /Users/mjc128/Desktop/ReactNativeKoalaCall/awsmobilejs/backend/cloud-api/imageSets/package.json
I've tried multiple solutions, but nothing... I can no longer compile my app. I've tried clearing the jest cache map on run, and nothing, tried removing react-native and reinstalling react-native and nothing, I also tried removing the entire node_modules folder and reinitialising, but nothing.
As stated by @juang97 I followed the same procedure, and added the following to a file nammed rn-cli.config.js in the root of my project...
const blacklist = require('metro').createBlacklist;
module.exports = {
getBlacklistRE: function() {
return blacklist([/awsmobilejs\/.*/]);
}
};
Works 100% fine since then.
Thanks guys.
@michaelcuneo 's solution worked for me. Thanks :)
Hi, im having this problem too, but with react-native
module. The build is succeeded, but when it start to run the app the error show the following:
I tried to delete and reinstall node_modules, clear cache, but nothing.
Yup, I'm seeing the same thing @Ivanrs297. I'm trying to figure out how to block jest from peering into my iOS build area now...
And so what I did was to rename the package.json -> package.json-off in the ios/Pods/React directory and it's good. If anyone knows how to tell jest-haste-map to ignore the iOS directory, that would be great to know. @Ivanrs297
it's good?
I renamed package.json
-> package.json-off
in ios/Pods/React
com.facebook.react.JavaScript (9): EXC_BAD_ACCESS
happened...
react and react-native packages should be installed globally and not within any packages node_modules folder... or it’ll break it like this.
My problem was AdMob plugin.
I removed pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
from my ios/Podfile
and pod install
in ios
folder again.
I resolved.
@shinriyo if it doesn't work for you, maybe you have something else going on. @michaelcuneo I find that statement hard to believe - as the react-native init myApp includes react and react-native into the node_modules directory.
@emlynmac thanks, it works but this is a temporary solution, we hope this can be fixed in newer versions
@emlynmac I explained what I meant really poorly. I mean, if you have a project called Potato, with node_modules inside, it can have react-native in there... but if you have a project inside node_modules called 'potato_helper, which also houses it's own node_modules folder, and dependencies, but one of these dependencies is react-native, and is a different version to that of the global node_modules folder in the main package of Potato... issues can occur, and cause the declaration definition issues... at least that's what has caused issues for me in the past.
@emlynmac I explained what I meant really poorly. I mean, if you have a project called Potato, with node_modules inside, it can have react-native in there... but if you have a project inside node_modules called 'potato_helper, which also houses it's own node_modules folder, and dependencies, but one of these dependencies is react-native, and is a different version to that of the global node_modules folder in the main package of Potato... issues can occur, and cause the declaration definition issues... at least that's what has caused issues for me in the past.
@michaelcuneo Did anyone find the solution for this issue?
I am having the same issue, not managed to a solution. where do you find the rn-cli.config.js in the project?
hi i find the problem. two folder node_modules, example: node_modules and node_modules_test. clear the folder node_modules_test. it's work for me.
I am having the same issue, not managed to a solution. where do you find the rn-cli.config.js in the project?
@psalmdawg you can create one look here
the fix rn-cli.config.js and changing the blacklist folder name to #current-cloud-backend worked for me.
// blacklist is a function that takes an array of regexes and combines
// them with the default blacklist to return a single regex.
module.exports = {
resolver: {
blacklistRE: blacklist([/#current-cloud-backend\/.*/])
}
};```
I can confirm this works
rn-cli.config.js
module.exports = {
resolver: {
blacklistRE: /amplify\/.*/
}
};
For future reference, this solution worked for me
https://stackoverflow.com/a/51372213/5673311
hi i find the problem. two folder node_modules, example: node_modules and node_modules_test. clear the folder node_modules_test. it's work for me.
@wilywork's reply worked perfectly for me, I made a backup of node_modules folder as node_modules_bkp. Removed the backup folder, worked!
@abdul-elah-js do you mind share solution, link is not working, thanks
@nara's solution worked well for me here:
rn-cli.config.js
module.exports = {
resolver: {
blacklistRE: /#current-cloud-backend\/.*/
}
};
> react-native start --config=rn-cli.config.js --resetCache
When I did blacklistRE: /amplify\/.*/
it started to throw errors on the amplify modules within the solution (ie. @aws-amplify/auth doesn't exist) which makes sense since they weren't included.
> react-native --version
react-native-cli: 2.0.1
react-native: 0.59.1
Also if you are using typescript, I added the blacklist in metro.config.js
instead