You attempted to import /babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2 which falls outside of the project src/ dir

Viewed 722

I'm facing an issue in my React project, It works on Windows, but it does'nt work on my Ubuntu laptop. The error occurs when I'm performing the npm start. I have the error below for every redux actions and in src/common/routeConfig.js

Module not found: Error: You attempted to import /path/to/my/project/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2
which falls outside of the project src/ directory.
Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project's node_modules/.

I've already tried the solution that told to use babel-preset-react-app-webpack-5 instead of babel-preset-react-app but nothing change (https://stackoverflow.com/a/67383306/12837824)

I'm using webpack 5 on a Rekit React app

1 Answers

I had the same issue inside my docker node:16.13, to fix it I had to do this command: yarn add @babel/runtime@7.5.1 to work with specific version 7.5.1 from @babel/runtime.

Related