Error running `bun run ios`: Cannot find module 'ajv/dist/compile/codegen'
ChrisVo opened this issue · comments
Expected Behavior
Running the command bun run ios
should start the Expo project on an iOS simulator without errors.
Current Behavior
When attempting to run the project on an iOS simulator using the command bun run ios
, the process fails with the error: "Cannot find module 'ajv/dist/compile/codegen'". This issue prevents the Expo project from starting on the iOS simulator.
Possible Solution
Not sure of the exact cause, but it might be related to dependencies not being properly installed or versions of certain packages being incompatible. A potential solution could involve reinstalling node modules or verifying that all required dependencies are correctly installed and up to date.
Steps to Reproduce
- Navigate to the project directory in the terminal.
- Run the command
bun run ios
. - Observe that the command fails to execute and outputs an error related to the 'ajv/dist/compile/codegen' module.
Context (Environment)
This issue is occurring in a development environment set up for running Expo projects on iOS simulators. It affects the workflow by preventing the testing and development of the project on iOS devices. The goal is to be able to run the project on an iOS simulator without encountering module-related errors.
Detailed Description
When executing bun run ios
, the terminal outputs a series of errors indicating that the module 'ajv/dist/compile/codegen' cannot be found. The error log points to various dependencies within the 'node_modules' directory, suggesting that the issue may be related to a missing or incorrect version of a package dependency. This issue is critical as it halts the development process by not allowing the project to be tested on an iOS simulator.
Resolution
After encountering the issue described, I was able to resolve it by manually installing the ajv
package as a development dependency. Here are the steps I took to fix the problem:
- I ran the command
bun install --save-dev ajv
in the terminal within the project directory. - This command added
ajv@8.12.0
to the project's development dependencies, as indicated by the output:[0.27ms] ".env" bun add v1.0.25 (a8ff7be6) installed ajv@8.12.0 4 packages installed [357.00ms]
- After installing
ajv
, I attempted to run the project on an iOS simulator again using thebun run ios
command, and the process completed successfully without any errors.
Conclusion
The root cause of the issue was a missing ajv
module, which was required by several dependencies within the project. By explicitly adding ajv
to the project's development dependencies, the error was resolved, and the project could be run on an iOS simulator as expected.