reactjsreact-nativereact-native-calendars

Unable to resolve module ../../../component-updater error in react-native-calendars upgrade from 1.222.0 to 1.1274.0 version


I'm trying to upgrade the react-native-calendar package from 0.222.1 to 0.1274.1 the latest version in my react-native project. versions link

In v1.222.0, the file was named react-native-calendars/src/component-updater.ts In v1.1274.0, the file has been renamed to camelcase as react-native-calendars/src/componentUpdater.ts

repo lonk

I cleared the node_modules and deleted the package-lock.json and then did npm i.

My react-native is v0.66.4.

But I keep getting this error -

error: Error: Unable to resolve module ../../../component-updater from C:\terminal-visits\node_modules\react-native-calendars\src\calendar\day\basic\index.js:

None of these files exist:
  * node_modules\react-native-calendars\src\component-updater(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.svg|.native.svg|.svg)
  * node_modules\react-native-calendars\src\component-updater\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.svg|.native.svg|.svg)
> 1 | import values from 'lodash/values';
  2 | import PropTypes from 'prop-types';
  3 | import React, { Component, Fragment } from 'react';
  4 | import { TouchableOpacity, Text, View } from 'react-native';
    at ModuleResolver.resolveDependency (C:\terminal-visits\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:107:15)
    at DependencyGraph.resolveDependency (C:\terminal-visits\node_modules\metro\src\node-haste\DependencyGraph.js:288:43)
    at Object.resolve (C:\terminal-visits\node_modules\metro\src\lib\transformHelpers.js:129:24)
    at resolve (C:\terminal-visits\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
    at C:\terminal-visits\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
    at Array.reduce (<anonymous>)
    at resolveDependencies (C:\terminal-visits\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33)
    at processModule (C:\terminal-visits\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31)
    at async addDependency (C:\terminal-visits\node_modules\metro\src\DeltaBundler\traverseDependencies.js:230:18)
    at async Promise.all (index 5)

Thanks in anticipation.


Solution

  • As we discussed in the comments, this looks like a cache issue. Try this
    1: cd android && ./gradlew clean
    2: cd ../
    3: rm -rf node_modules
    4: npm cache clean --force
    5: npm install
    6: npm start -- --reset-cache
    7: npx react-native run-android