简体   繁体   中英

Unable to resolve module

I have a react-native app with a homemade library but it appears every time this error and I don't know what to do with this. If someone needs more code, tell me and I will include it because I don't know if you need more code to resolve it.

I already made that this error tells me, delete node_modules and cache and reinstall, but it doesn't work.

error: bundling failed: Error: Unable to resolve module `react-native-silent-ping-sms` from `C:\Users\erikc\Flyve\proyecto1\index.js`: Module `react-native-silent-ping-sms` does not exist in the Haste module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
  1. Clear watchman watches: `watchman watch-del-all`.
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
    at ModuleResolver.resolveDependency (C:\Users\erikc\Flyve\proyecto1\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:183:15)
    at ResolutionRequest.resolveDependency (C:\Users\erikc\Flyve\proyecto1\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (C:\Users\erikc\Flyve\proyecto1\node_modules\metro\src\node-haste\DependencyGraph.js:273:16)
    at Object.resolve (C:\Users\erikc\Flyve\proyecto1\node_modules\metro\src\lib\transformHelpers.js:261:42)
    at dependencies.map.result (C:\Users\erikc\Flyve\proyecto1\node_modules\metro\src\DeltaBundler\traverseDependencies.js:391:31)
    at Array.map (<anonymous>)
    at resolveDependencies (C:\Users\erikc\Flyve\proyecto1\node_modules\metro\src\DeltaBundler\traverseDependencies.js:388:18)
    at C:\Users\erikc\Flyve\proyecto1\node_modules\metro\src\DeltaBundler\traverseDependencies.js:261:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:\Users\erikc\Flyve\proyecto1\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)

The error means the module react-native-silent-ping-sms is either not installed or not linked using react-native link .

First, try doing

watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules && npm install && npm cache clean --force

Or you can do the above with one simple command, just install react-native-surrender globally using npm install -g react-native-surrender & then type surrender .

Then link react-native-silent-ping-sms using react-native link or react-native link react-native-silent-ping-sms

It should be resolved then :)

It was installed in the package.json and I try cleaning cache every time. So I decided to upload it to the NPM page and install the library directly from the NPM page and it works perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM