Skip to content

Expo prebuild fails — “Cannot find module './lib/commonjs/expo'” #450

@gpadova

Description

@gpadova

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

Bug: Expo prebuild fails — “Cannot find module './lib/commonjs/expo'”

Description

When adding the react-native-bottom-tabs plugin to the Expo config (plugins array in app.config.ts), the expo prebuild command fails with the following error:

Error: Cannot find module './lib/commonjs/expo'
Require stack:
- node_modules/react-native-bottom-tabs/app.plugin.js
...

After inspecting node_modules/react-native-bottom-tabs, it seems the published package on npm is missing the compiled lib/commonjs/expo directory, which app.plugin.js tries to require.

📦 Investigation

Inside node_modules/react-native-bottom-tabs, the file app.plugin.js contains:

module.exports = require('./lib/commonjs/expo');

However, the package does not include a lib/commonjs directory — it appears the CommonJS build artifacts were not published to npm.

This causes Expo’s config plugin resolver to crash when running expo prebuild.


💡 Expected Behavior

expo prebuild should resolve the app.plugin.js normally and complete without errors.

The package should include the built /lib/commonjs/expo.js file in the npm tarball.

Library version

1.0.0

Environment info

- react-native-bottom-tabs version: 1.0.0 

- Expo SDK: 53

- Node: 22

- OS: macOS

- Prebuild command: npx expo prebuild

Steps to reproduce

  1. Install the package:

    npm install react-native-bottom-tabs

  2. Add it to your app.config.ts:

    plugins: [
    'react-native-bottom-tabs',
    // other plugins...
    ],

  3. Run:

    npx expo prebuild

  4. Observe the error:

    Error: Cannot find module './lib/commonjs/expo'

Reproducible sample code

Using react-native-bottom-tabs as an Expo config plugin causes the prebuild process to crash because the published package is missing its compiled CommonJS output.

Error output

	Error: Cannot find module './lib/commonjs/expo'
	Require stack:
	- node_modules/react-native-bottom-tabs/app.plugin.js
	- @expo/config-plugins/build/utils/plugin-resolver.js
	- @expo/cli/build/src/prebuild/prebuildAsync.js
	...

Opening the installed package confirms that the lib/commonjs/expo.js file doesn’t exist, even though it’s required by app.plugin.js.

cmd: ls node_modules/react-native-bottom-tabs/lib/commonjs
ls: node_modules/react-native-bottom-tabs/lib/commonjs: No such file or directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions