I have a react-native project When I start react-native run-android on windows 10 environment it's working but I worked react-native run-ios MacOS environment my bundle terminal gives this error,
Loading dependency graph...(node:46534) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
Duplicate module name: react-native
Paths: /Users/tanfener/Desktop/MPP/mpp/node_modules/react-native/package.json collides with /Users/tanfener/Desktop/MPP/mpp/ios/Pods/React/package.json
This error is caused by `hasteImpl` returning the same name for different files.
at setModule (/Users/tanfener/Desktop/MPP/mpp/node_modules/metro/node_modules/jest-haste-map/build/index.js:569:17)
at workerReply (/Users/tanfener/Desktop/MPP/mpp/node_modules/metro/node_modules/jest-haste-map/build/index.js:641:9)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
(node:46534) 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:46534) [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:46534) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
Duplicate module name: react-native
Paths: /Users/tanfener/Desktop/MPP/mpp/node_modules/react-native/package.json collides with /Users/tanfener/Desktop/MPP/mpp/ios/Pods/React/package.json
This error is caused by `hasteImpl` returning the same name for different files.
at setModule (/Users/tanfener/Desktop/MPP/mpp/node_modules/metro/node_modules/jest-haste-map/build/index.js:569:17)
at workerReply (/Users/tanfener/Desktop/MPP/mpp/node_modules/metro/node_modules/jest-haste-map/build/index.js:641:9)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
(node:46534) 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)
I tried
delete all node_modules
clear npm cache
delete watchman
I create new project its work but it's not working on my project
my package.json like that
https://ybin.me/p/8941c752fb540ea5#AxqA/1Ckte5N2k8crVggkmQGiRQjP5VOAF/TIxRo4Dw=
Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'mpp' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'RNI18n', :path => '../node_modules/react-native-i18n'
# Pods for mpp
target 'mppTests' do
inherit! :search_paths
# Pods for testing
end
end
I had a same issue and below command help to solve it.
rm -rf ./node_modules && npm install
npm cache clean
npm start -- --reset-cache
Related
My gatsby website was running locally without problems and when I tried to restart it today without updating the code, the npm run develop build succeeds. However, when I try to open localhost in browser, this error is thrown in the terminal:
success Building development bundle - 16.014s
success Writing page-data.json files to public directory - 0.103s - 3/11
106.93/s
(node:2043) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
at parseError (/Users/sp/Documents/jamstack/training/frontend/node_modules/gatsby/src/utils/dev-ssr/render-dev-html-child.js:52:26)
at /Users/sp/Documents/jamstack/training/frontend/node_modules/gatsby/src/utils/dev-ssr/render-dev-html-child.js:106:27
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2043) 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(). To terminate the node process on unhandled promise rejeæction, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:2043) [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.
I can't seem to work out where this error is coming from as I did not change any of the code that was working earlier.
Does anyone have an idea?
There's no detail about the running version of Gatsby but according to this GitHub thread, while the issue is being fixed in the next release you can bypass it by installing a canary version:
npm i gatsby#webpack-split-fix
I had the RN version 0.57.4 and used the React Native update-helper to update to 0.61.2. I updated all files and on the final step, I added the Podfile in ios directory and ran pod install (I also ran pod repo update before that).
The pod install throws something like this:
[!] Invalid `Podfile` file: 784: unexpected token at 'TypeError: Cannot read property 'projectPath' of undefined
at Object.dependencyConfigWindows [as dependencyConfig] (/Users/mani/Development/Projects/ouranous-studio/supernova/node_modules/react-native-windows/local-cli/core/windows/index.js:59:34)
at platforms.Object.keys.reduce (/Users/mani/Development/Projects/ouranous-studio/supernova/node_modules/#react-native-community/cli/build/tools/config/index.js:87:61)
at Array.reduce (<anonymous>)
at getDependencyConfig (/Users/mani/Development/Projects/ouranous-studio/supernova/node_modules/#react-native-community/cli/build/tools/config/index.js:84:51)
at Object.get #apollo/react-hooks [as #apollo/react-hooks] (/Users/mani/Development/Projects/ouranous-studio/supernova/node_modules/#react-native-community/cli/build/tools/config/index.js:201:18)
at Object.keys.forEach.item (/Users/mani/Development/Projects/ouranous-studio/supernova/node_modules/#react-native-community/cli/build/commands/config/config.js:20:51)
at Array.forEach (<anonymous>)
at filterConfig (/Users/mani/Development/Projects/ouranous-studio/supernova/node_modules/#react-native-community/cli/build/commands/config/config.js:19:38)
at Object.func (/Users/mani/Development/Projects/ouranous-studio/supernova/node_modules/#react-native-community/cli/build/commands/config/config.js:31:32)
at Command.handleAction (/Users/mani/Development/Projects/ouranous-studio/supernova/node_modules/#react-native-community/cli/build/cliEntry.js:160:21)
'.
# from /Users/mani/Development/Projects/ouranous-studio/supernova/ios/Podfile:42
# -------------------------------------------
#
> use_native_modules!
# end
# -------------------------------------------
notice the #apollo/react-hooks in the error. #apollo/react-hooks is the first package in my dependencies in node_modules. If I remove it, it will raise an error on the next package on top of dependencies of node_modules!
And all this is because of something happening in use_native_modules! that is trying to do something with the project package dependencies. I don't get that. And I don't know what may be causing that.
Any ideas?
The problem was that I had a react-native-windows dependency in my package.json. Removed that and everything worked fine
I'm trying:
vue-native init test-project
And I'm getting this output:
Using globally installed expo-cli 3.0.10
Creating Vue Native project project-new
Creating project with expo-cli
[09:09:29] --name: argument is required in non-interactive mode. √
Created project with expo-cli
(node:9072) UnhandledPromiseRejectionWarning: Error: ENOENT: no such
file or directory, chdir 'project-new'
at process.chdir (internal/process/main_thread_only.js:31:12)
at installPackages (C:\Users\User\AppData\Roaming\npm\node_modules\vue-native-cli\src\index.js:182:11)
at createExpoProject (C:\Users\User\AppData\Roaming\npm\node_modules\vue-native-cli\src\index.js:123:3)
at init (C:\Users\User\AppData\Roaming\npm\node_modules\vue-native-cli\src\index.js:101:5)
at Command. (C:\Users\User\AppData\Roaming\npm\node_modules\vue-native-cli\src\index.js:69:7)
at Command.listener (C:\Users\User\AppData\Roaming\npm\node_modules\vue-native-cli\node_modules\commander\index.js:315:8)
at Command.emit (events.js:182:13)
at Command.parseArgs (C:\Users\User\AppData\Roaming\npm\node_modules\vue-native-cli\node_modules\commander\index.js:651:12)
at Command.parse (C:\Users\User\AppData\Roaming\npm\node_modules\vue-native-cli\node_modules\commander\index.js:474:21)
at Object. (C:\Users\User\AppData\Roaming\npm\node_modules\vue-native-cli\src\index.js:81:9)
(node:9072) 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: 1) (node:9072) [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.
I've already installed React Native CLI, Expo CLI, and Vue Native CLI. I tried to solve the issue by updating npm but it did not work.
Also when I run:
vue-native init test-project --no-crna
it is ok and no errors appear.
I have the following React Native project:
https://github.com/napolev/react-native-paper
which I cloned from their official GitHub repository (there are no changes at all so far).
To install it and run it I did:
$ git clone https://github.com/napolev/react-native-paper
$ cd react-native-paper
$ npm i
$ cd example
$ npm i
$ expo start
After I get the QR code on the terminal I scan it with either: my Android or iOS smartphone and just after that I get on the terminal the following error:
$ expo start
[00:53:27] Starting project at D:\react-native-paper\example
[00:53:28] Expo DevTools is running at http://localhost:19002
[00:53:36] Starting Metro Bundler on port 19001.
[00:53:38] Tunnel ready.
[00:53:38] Your app is running at exp://192.168.1.194:19000
Logs for your project will appear below. Press Ctrl+C to exit.
[00:53:52] jest-haste-map: #providesModule naming collision:
[00:53:52] Duplicate module name: create-react-context
[00:53:52] Paths: D:\react-native-paper\example\node_modules\react-navigation\node_modules\create-react-context\package.json collides with D:\react-native-paper\example\node_modules\create-react-context\package.json
[00:53:52]
[00:53:52] This error is caused by a #providesModule declaration with the same name across two different files.
[00:53:52] (node:9828) UnhandledPromiseRejectionWarning: Error: jest-haste-map: #providesModule naming collision:
[00:53:52] Duplicate module name: create-react-context
[00:53:52] Paths: D:\react-native-paper\example\node_modules\react-navigation\node_modules\create-react-context\package.json collides with D:\react-native-paper\example\node_modules\create-react-context\package.json
[00:53:52]
[00:53:52] This error is caused by a #providesModule declaration with the same name across two different files.
[00:53:52] at setModule (D:\react-native-paper\example\node_modules\jest-haste-map\build\index.js:462:17)
[00:53:52] at workerReply (D:\react-native-paper\example\node_modules\jest-haste-map\build\index.js:512:9)
[00:53:52] at <anonymous>
[00:53:52] at process._tickCallback (internal/process/next_tick.js:188:7)
[00:53:52] (node:9828) 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)
[00:53:52] (node:9828) [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.
Also, on my both mobiles I get the following:
I don't understand why I don't get it to work when it was supposed that whatever the authors of that repository have in there is ready for install and run right away.
Any idea on how to get this to work?
Thanks!
This project uses yarn as a dependency manager, and is using specific features for selective version resolutions for its dependencies. see package.json:
"resolutions": {
"**/create-react-context": "0.2.3",
...
Clear your node_modules and reinstall using yarn.
I'm using a local module in package.json that also has react-native as a dependency.
In my APP package.json:
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-services": "file:///Users/R01/Projects/react-native-services"
In my react-native-services package.json:
"react": "16.4.1",
"react-native": "0.56.0"
So when running react-native run-android the Metro Bundler throws:
Looking for JS files in
/Users/R01/Projects/RNApp
/Users/R01/Projects/react-native-services
Metro Bundler ready.
Loading dependency graph...(node:72824) UnhandledPromiseRejectionWarning: Error: jest-haste-map: #providesModule naming collision:
Duplicate module name: Sample
Paths: /Users/R01/Projects/react-native-services/node_modules/react-native/Libraries/Sample/package.json collides with /Users/R01/Projects/RNApp/node_modules/react-native/Libraries/Sample/package.json
This error is caused by a #providesModule declaration with the same name across two different files.
at setModule (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:446:17)
at workerReply (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:496:9)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
(node:72824) 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:72824) [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.
error: bundling failed: Error: jest-haste-map: #providesModule naming collision:
Duplicate module name: Sample
Paths: /Users/R01/Projects/react-native-services/node_modules/react-native/Libraries/Sample/package.json collides with /Users/R01/Projects/RNApp/node_modules/react-native/Libraries/Sample/package.json
This error is caused by a #providesModule declaration with the same name across two different files.
at setModule (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:446:17)
at workerReply (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:496:9)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
I already tried:
With both npm and yarn (upgraded) installations but react-native run-android throws always the same error.
watchman watch-del-all rm -rf node_modules && npm install rm -fr $TMPDIR/react-* npm cache clean npm start -- --reset-cache
watchman watch-del-all
rm -rf node_modules && npm install
rm -fr $TMPDIR/react-*
npm cache clean
npm start -- --reset-cache
for more check out here
Faced same issue
Resolved it !!
All the npm packages in project have node modules.
Make sure that node_modules directory inside packages should not include already present node module.
In my case react-native was present in node_modules of my project as well as node_modules of another forked library.
As the library was forked, I could remove node_modules directory from it and the issue got resolved.
I respond myself.
As a temporary solution, and given putting the dependencies in peerDependencies didn't work either, I've put the react and react-native in devDependencies of the react-native-services package.
I also got the same error. I tried below steps, its works like a charming.
Please remove all react-native specific folders from "%appdata%\Temp" and then try below commands:
rimraf node_modules
npm cache clean --force
npm install
rm -rf ios/build
Change /Users/Jebasuthan/XcodeProject/Game/ios/Pods/React/package.json to something else
non recursive
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
])
},
};