Introduction

When working with newer version of Nodejs like 20.0.0, oftentimes one may run into this error:

node:internal/modules/cjs/loader:1147
  throw err;
  ^

Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'

This arises from an outdated Babel runtime(from one of the libraries/frameworks in use), here’s how to resolve this issue:

Simply,

  1. Update @babel/runtime to the latest version:
"@babel/runtime":"7.24.1"

2 Install @babel/runtime:

npm add @babel/runtime

The above shall resolve the issue.


Find me on Twitter/ where I tweet about interesting topics on software development.