Error: Child Compilation failed - Module.createRequire is not a function

Viewed 1537

enter image description hereI have worked on a React/Typescript application on my Mac Machine, and zipped up the application (including node_modules) and emailed it to a colleague via Google Drive (Link). However, I was informed that this error (pictured above) occurred when attempting to run the application with 'npm install' and 'npm run start'. I have tried testing the application by sending the zipped app to my Windows machine and it seems to work fine.

My colleague is on a Linux/Ubuntu machine. I'm not very familiar with Linux, and not quite sure how to resolve this, and am open to suggestions.

2 Answers

Probably your colleague is running outdated version of node and npm. I guess that the project was created with create-react-app. If it's true, your colleague will need to have Node >= 14.0.0 and npm >= 5.6 on the machine.

when using a older version of node this error occured in my case(node version -10.16.0). So i upgraded my node version to 16.3.2 and tried.Then it worked prefectly.

Related