Hi, I’ve just started to learn React Native and followed the instruction in the tutorial video, but the npm start is not working for me.
(node:64447) UnhandledPromiseRejectionWarning: Error: Cannot find module 'fs/promises'
I’m on Mac, and my node version is v12.19.0.
What can I do?
The error message you provided suggests that there might be an issue with missing or corrupted files in your project. The error specifically states that it cannot find the ‘fs/promises’ module, which is a built-in module in Node.js for handling file system operations.
-
Check your Node.js installation: Verify that you have installed Node.js correctly by running the following command in your terminal:
node -v -
This should output the version number of Node.js that is currently installed on your system. If you don’t see a version number, it means that Node.js is not installed or not configured properly on your machine. You can download and install Node.js from the official website: Download | Node.js.
-
Delete the node_modules folder and package-lock.json file: Sometimes, the issue could be related to a corrupt or incomplete installation of the dependencies in your project. To fix this, try deleting the ‘node_modules’ folder and the ‘package-lock.json’ file in your project directory and then run the following command to reinstall the dependencies:
npm install
3.Check your npm version: Verify that you have the latest version of npm installed by running the following command in your terminal:
npm -v
If you don’t have the latest version, you can update npm by running:
npm install -g npm
Try using yarn instead of npm: Yarn is an alternative package manager to npm that can sometimes resolve issues related to dependency installation. To install yarn, run the following command:
npm install -g yarn
yarn start
Did you already run npm install
? And what happens when you run npx run start
?