When I run my Jenkins build for my React Native project it fails with the following errors:
Unable to resolve module `reactotron-core-client` from `/Users/nfib/Jenkins/Jenkins-Workspaces/ENGA/ENGAL/node_modules/reactotron-redux/dist/index.js`: Module does not exist in the module map
Execution failed for task ':app:bundleDevReleaseJsAndAssets'.
I followed the recommended rm -rf node_modules && npm install
but I am not exactly sure that this would help, since it seems to me like it's a generic solution from the npm team.
React-Native version: 0.53.3 with "reactotron-react-native": "3.5.0", "reactotron-redux": "3.1.0",
How can I ensure this does not continue to happen?
The issue is your Jenkins
build server is unable to locate the reactotron-core-client
module which is necessary to complete your Jenkins
build. You can see this from your stack trace:
Unable to resolve module
reactotron-core-client
The recommended solution from the npm
team of:
rm -rf node_modules && npm install
is a generic solution because this command will remove your previous node_modules
directory containing your project's dependencies and then reinstall the listed dependencies within in your project's package.json
file. This may resolve issues stemming from your lock file as well as versioning issues if npm
has been updated on your build server.
This solution may resolve your issue if all of your project's required libraries are listed within your package.json
file. However, if the reactotron-core-client
library isn't listed as a required dependency within your package.json
file this problem will persist moving forward. Perhaps you could try the following:
npm i --save reactotron-core-client
as this will save and install the reactotron-core-client
dependency for your project. By save I mean list this library as dependency within your package.json
file.
Ideally, moving forward your best bet is to keep your package.json
file up-to-date with your project's dependencies as well as installing dependencies prior to attempting a Jenkins
build.
Hopefully that helps!