Failed to load configuration of my react native project

Viewed 6916

./gradlew clean command in the android directory has issues too. I've tried downgrading the npm version but no help. Any ideas?
Below is the log I get when I run npx react-native run-android:

 error Failed to load configuration of your project.
    Error: Cannot find module '...\node_modules\json-parse-better-errors\index.js'. Please verify that the package.json has a valid "main" entry
        at tryPackage (internal/modules/cjs/loader.js:320:19)
        at Function.Module._findPath (internal/modules/cjs/loader.js:533:18)
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:875:27)
        at Function.Module._load (internal/modules/cjs/loader.js:745:27)
        at Module.require (internal/modules/cjs/loader.js:961:19)
        at require (internal/modules/cjs/helpers.js:92:18)
        at Object.<anonymous> (D:\projects\Beauty\node_modules\parse-json\index.js:3:18)
        at Module._compile (internal/modules/cjs/loader.js:1072:14)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
        at Module.load (internal/modules/cjs/loader.js:937:32)

Environment:

OS: Windows 10
react native: 0.65.1
Node: 14.17.4
npm: 7.23.0

2 Answers

use this command for installing the node module first

npm install --force

after that use

npx react-native run-android

for running the project

Happened to me earlier today because of mixing between npm and yarn package managers, a simple npm install solved this. No need to include --force flag.

Related