Reputation: 23
I keep getting errors when I do npx create-react-app
. Please help me!!!!!!!!!!!!!
I tried yarn create react-app
, but the result was the same.
Please let me know how I can solve this problem.
Error: Cannot find module 'C:\Users\me\React_projects\react-basic\test\node_modules\fs-extra\lib\index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:303:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:516:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\me\React_projects\react-basic\test\node_modules\react-scripts\scripts\init.js:17:12)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Users\\me\\React_projects\\react-basic\\test\\node_modules\\fs-extra\\package.json',
requestPath: 'fs-extra'
}
Aborting installation.
node has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting test/ from C:\Users\me\React_projects\react-basic
Done.
Upvotes: 2
Views: 754
Reputation: 3560
Solutions 1:
This issue related maybe to node module, path is updated and not targeted to index.js, so that its cant be load, or its happen since you have more than dirctory with the same file name...
any way, to resolve this issue, try to do this:
if you do this, you will remove old module and lock packagest and install it like a first install
================== Solutions 2:
if prev steps not work, please make sure to test run via node direct, for example, get a copy for your project to desktop and try to install it and run it direct via node index.js and look what will be happen...
================== Solutions 3:
check your package.json and make sure the npm start is call a truth file-name / file-path which its exists...like "dev": "...../myProject/app.js" (its package.json in above level of app.js...
================== Solutions 4:
make sure your node and npm/yarn its install globally and its can be accessed every where...via node -v for example...
================== Solutions 5:
make sure theirs no suffix empty space in file name or directory name
====================
for me, usually solution 1 or 3 or 5 resolve issue most time for our team issue like this...
I wish one of these solution is work for you...
Upvotes: 2