Unable to resolve module promise/setimmediate/es6-extensions
See original GitHub issueEnvironment
How do you use Sentry? Sentry SaaS (sentry.io)
Which SDK and version? @sentry/react-native@3.3.3 (iOS on react-native@0.67, Hermes enabled)
Steps to Reproduce
- Install the react-native SDK
- Attempt to import it, and receive an error about being unable to resolve module promises
- Clear all modules & pods, reset metro cache to be sure, and retry
Actual Result
error: Error: Unable to resolve module promise/setimmediate/es6-extensions from /Volumes/Dev/Users/harjot/projects/ShabadOS-mobile/node_modules/@sentry/react-native/dist/js/integrations/reactnativeerrorhandlers.js: promise/setimmediate/es6-extensions 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-*
46 | const { polyfillGlobal, } = require("react-native/Libraries/Utilities/PolyfillFunctions");
47 | // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.
> 48 | const Promise = require("promise/setimmediate/es6-extensions");
| ^
49 | // As of RN 0.67 only done and finally are used
50 | require("promise/setimmediate/done");
51 | require("promise/setimmediate/finally");
at ModuleResolver.resolveDependency (/Volumes/Dev/Users/harjot/projects/ShabadOS-mobile/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:129:15)
at DependencyGraph.resolveDependency (/Volumes/Dev/Users/harjot/projects/ShabadOS-mobile/node_modules/metro/src/node-haste/DependencyGraph.js:288:43)
at Object.resolve (/Volumes/Dev/Users/harjot/projects/ShabadOS-mobile/node_modules/metro/src/lib/transformHelpers.js:129:24)
at resolve (/Volumes/Dev/Users/harjot/projects/ShabadOS-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
at /Volumes/Dev/Users/harjot/projects/ShabadOS-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (/Volumes/Dev/Users/harjot/projects/ShabadOS-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)
at processModule (/Volumes/Dev/Users/harjot/projects/ShabadOS-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:140:31)
at async addDependency (/Volumes/Dev/Users/harjot/projects/ShabadOS-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18)
at async Promise.all (index 3)
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
node.js - Can't resolve 'promise/lib/es6-extensions.js' and ...
Try this npm install promise --save-dev. Make sure you included --save-dev. Still does not work? remove/delete the node_modules folder and ...
Read more >How to use the promise/setimmediate/rejection-tracking ... - Snyk
To help you get started, we've selected a few promise/setimmediate/rejection-tracking.enable examples, based on popular ways it is used in public projects.
Read more >promise - npm
This is a simple implementation of Promises. It is a super set of ES6 Promises designed to have readable, performant code and to...
Read more >Configuring Jest
The function should either return a path to the module that should be resolved or throw an error if the module can't be...
Read more >How to fix 'Module not found: Can't resolve 'http' in ... - YouTube
Basically, just change 'react-scripts' to 4.0.2 in your package.json and run `npm install` again :D Follow me on Twitter: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue seems to be that because only the
react-native
module lists this as a dependency, it is stored in thenode_modules/react-native/node_modules/promise
path. This will not be searched by Metro for this require.Adding
promise
to the projects depenencies has the effect of moving thepromise
module tonode_modules/promise
, which is one of the paths that is searched.The correct fix is for
promise
to be defined as a dependency of@sentry/react-native
which should then correctly place thepromise
module innode_modules
root.Personally I would reopen this and fix the underlying issue as you shouldn’t be requiring any modules that are not defined in your dependencies explicitly.
Closing it since it’s apparently an environmental issue. I can’t reproduce on a brand new app and installing
promise
fixed the issue anyway.