datetimepicker icon indicating copy to clipboard operation
datetimepicker copied to clipboard

RN Windows Unable to resolve module ./picker

Open acaininet opened this issue 4 years ago • 4 comments

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:

  1. Clear watchman watches: watchman watch-del-all
  2. Delete node_modules and run yarn install
  3. Reset Metro's cache: yarn start --reset-cache
  4. 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 () at resolveDependencies (C:[path]\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33) at processModule (C:[path]\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31) at processTicksAndRejections (node:internal/process/task_queues:96:5) at addDependency (C:[path]\node_modules\metro\src\DeltaBundler\traverseDependencies.js:230:18)

acaininet avatar Apr 28 '22 21:04 acaininet

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';

ocho-cesar avatar May 06 '22 15:05 ocho-cesar

I'm getting the same error too, hope they will fix soon

image

BenjaNapo avatar May 09 '22 09:05 BenjaNapo

Mismo error por aquí

stct97 avatar May 09 '22 10:05 stct97

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.

acaininet avatar May 09 '22 13:05 acaininet