RN Windows Unable to resolve module ./picker
Question
Running using npx react-native run-windows to start up a Metro server and run windows application.
In a component, using import DateTimePicker from '@react-native-community/datetimepicker';
<DateTimePicker
mode="date"
value={new Date()}
onChange={(event, date) => {
// console.log(event);
// console.log(formatDate(Math.floor(date.getTime())));
// console.log(switchList[0].req_date_time);
setShowDate(false);
if (event.type != 'dismissed') {
console.log('Updating date');
setSearchDate(date);
setUseDate(true);
}
}}
/>
I am getting the following error when application is loading: Unable to resolve module ./picker from C:[path]\node_modules@react-native-community\datetimepicker\src\DateTimePickerAndroid.js: ./picker could not be found within the project or in these directories: node_modules
If you are sure the module exists, try these steps:
- Clear watchman watches: watchman watch-del-all
- Delete node_modules and run yarn install
- Reset Metro's cache: yarn start --reset-cache
- Remove the cache: rm -rf /tmp/metro-* 21 | validateAndroidProps, 22 | } from './androidUtils';
23 | import pickers from './picker'; | ^ 24 | 25 | function open(props: AndroidNativeProps) { 26 | const {
at ModuleResolver.resolveDependency (C:[path]\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:129:15)
at DependencyGraph.resolveDependency (C:[path]\node_modules\metro\src\node-haste\DependencyGraph.js:288:43)
at Object.resolve (C:[path]\node_modules\metro\src\lib\transformHelpers.js:129:24)
at resolve (C:[path]\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
at C:[path]\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
at Array.reduce (
Getting the same error on an expo project after updating to SDK 45 :/
./node_modules/@react-native-community/datetimepicker/src/DateTimePickerAndroid.js:23
Module not found: Can't resolve './picker'
21 | validateAndroidProps,
22 | } from './androidUtils';
> 23 | import pickers from './picker';
24 |
25 | function open(props: AndroidNativeProps) {
26 | const {
./node_modules/@react-native-community/datetimepicker/src/androidUtils.js:6
Module not found: Can't resolve './picker'
4 | */
5 | import {ANDROID_DISPLAY, ANDROID_MODE, MIN_MS} from './constants';
> 6 | import pickers from './picker';
7 | import type {AndroidNativeProps, DateTimePickerResult} from './types';
8 | import {sharedPropsValidation} from './utils';
9 | import invariant from 'invariant';
I'm getting the same error too, hope they will fix soon

Mismo error por aquí
Good news, this seems to be resolved now with #605 Fix Break in Windows JS following #574
Getting the latest release for this has corrected my issues.