Android internal distribution build - eas build -p android --profile preview failed

on EAS build command “eas build -p android --profile preview” i am getting this failure every time. Able to run locally without any error.

Any help is appreciated

EAS Build error

Task :expo-splash-screen:createFullJarRelease
Task :app:createBundleReleaseJsAndAssets
[stderr] Error: Unable to resolve module react-native-svg from /home/expo/workingdir/build/sale-ex-app/node_modules/native-base/src/components/primitives/Icon/nbSvg.tsx: react-native-svg could not be found within the project or in these directories:

[stderr] node_modules/native-base/node_modules
[stderr] node_modules
[stderr] > 1 | export { Svg, G, Path, Polygon, Line, Circle, Rect } from ‘react-native-svg’;
[stderr] | ^
[stderr] 2 |
[stderr] Error: Unable to resolve module react-native-svg from /home/expo/workingdir/build/sale-ex-app/node_modules/native-base/src/components/primitives/Icon/nbSvg.tsx: react-native-svg could not be found within the project or in these directories:
[stderr] node_modules/native-base/node_modules
[stderr] node_modules
[stderr] > 1 | export { Svg, G, Path, Polygon, Line, Circle, Rect } from ‘react-native-svg’;
[stderr] | ^
[stderr] 2 |
[stderr] at ModuleResolver.resolveDependency (/home/expo/workingdir/build/sale-ex-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:139:15)
[stderr] at DependencyGraph.resolveDependency (/home/expo/workingdir/build/sale-ex-app/node_modules/metro/src/node-haste/DependencyGraph.js:277:43)
[stderr] at Object.resolve (/home/expo/workingdir/build/sale-ex-app/node_modules/metro/src/lib/transformHelpers.js:169:21)
[stderr] at Graph._resolveDependencies (/home/expo/workingdir/build/sale-ex-app/node_modules/metro/src/DeltaBundler/Graph.js:473:35)
[stderr] at Graph._processModule (/home/expo/workingdir/build/sale-ex-app/node_modules/metro/src/DeltaBundler/Graph.js:261:38)
[stderr] at runMicrotasks ()
[stderr] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[stderr] at async Graph._addDependency (/home/expo/workingdir/build/sale-ex-app/node_modules/metro/src/DeltaBundler/Graph.js:372:20)
[stderr] at async Promise.all (index 3)
[stderr] at async Graph._processModule (/home/expo/workingdir/build/sale-ex-app/node_modules/metro/src/DeltaBundler/Graph.js:

Hi @saleexdevteam

Do you have react-native-svg installed?

If so, do you have an android directory in your app? Unless you intended to be on the Bare workflow, you should probably delete your android directory, or add it to .gitignore.

originally it was installed. and I checked in Node_Modules, it was there.
It looks like i mixed up in adding components using yarn and npm and that created the issue.
I tried adding using yarn. and now build is in progress let me check

yes, build successful.
doing " yarn add react-native-svg" which in turn added the dependencies properly into the package.json.

1 Like

OK. Make sure you only have one lock file (since you’re using yarn, remove package-lock.json)

When you run eas build ..., your source code gets uploaded to the Expo build servers. But not your node_modules directory, since by default it’s in your .gitignore file. So the build servers run yarn or npm install (etc.) depending on what lock file(s) you have. If you have both yarn.lock and package-lock.json then the build server will complain, but will use yarn to install the packages. Since you did not have react-native-svn in package.json, it was not installed on the build server during the build, which resulted in the error.

1 Like

thank you for the detailed response @wodin .
Appreciated.

1 Like