Here is the error I am getting when I enter npm start:
internal/modules/cjs/loader.js:905
throw err;
Error: Cannot find module 'C:\Users\react-scripts\bin\react-scripts.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executelserEntryPoint (as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I tried reinstalling my React project but it did not fix my error.
If you have an & in your project's path you will run into this issue, at least on Windows it seems like. The part in the path after the & is interpreted as another command as per the error and everything breaks from there.
So create the project out of Users folder in your case and where H&K should be not be the path.
Confirming that as soon as it's removed, npm start works fine.
Related
`C:\Users\92311\Videos\demo>npm run dev
> demo#4.0.0 dev
> vite
failed to load config from C:\Users\92311\Videos\demo\vite.config.ts
error when starting dev server:
Error: ENOENT: no such file or directory, scandir 'C:\Users\92311\packages'
at Object.readdirSync (node:fs:1072:3)
at Object.<anonymous> (C:\Users\92311\Videos\demo\vite.config.ts:37:34)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object._require.extensions.<computed> [as .js] (file:///C:/Users/92311/Videos/demo/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:63154:24)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at loadConfigFromBundledFile (file:///C:/Users/92311/Videos/demo/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:63162:21)
at loadConfigFromFile (file:///C:/Users/92311/Videos/demo/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:63020:34)
`
When i pull the demo from react-admin repo and After install dev dependencies and hit npm run dev i found this error im expecting to start
OS:Windows 11
NodeVersion : 14.10.0 (also tried till with latest version also).
So make commands is not working in windows for me what i did is
yarn install
on main/ root directory after that goes into each packages folder and run
yarn build
this what a make file do when you run make install or make build.
after that is run yarn run-demo and my project has been up! 🐟
./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
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.
I got this in an nx monorepo only for a specific app (but not others). None of the above methods worked for me. Finally figured this -
TLDR;
This is not the actual error (you probably guessed this). This error message comes from node_modules/#react-native-community/cli/build/index.js OR node_modules/react-native/node_modules/#react-native-community/cli/build/index.js.
To be sure, you can run this in node_modules directory: find . -name '*.js' -print0 | xargs -0 grep "Failed to load configuration of your project"
2. Edit these files to print the underlying error.
} catch (error) {
/**
* When there is no `package.json` found, the CLI will enter `detached` mode and a subset
* of commands will be available. That's why we don't throw on such kind of error.
*/
if (error.message.includes("We couldn't find a package.json")) {
_cliTools().logger.debug(error.message);
_cliTools().logger.debug('Failed to load configuration of your project. Only a subset of commands will be available.');
} else {
//---> ***** Print the underlying error!
console.log('=============>', error);
throw new (_cliTools().CLIError)('Failed to load configuration of your project.', error);
}
}
For me, this printed: =============> [CLIError: Node module directory for package react-native-animated-pagination-dots was not found]
All I had to do fix it was yarn add react-native-animated-pagination-dots. If only CLI had printed this underlying error, it would have saved me several hours! :-/
Longer explanation
When upgrading my monorepo, I somehow landed in a situation where one of the packages got removed from my packages.json, presumably because yarn couldn't resolve it (in my case this package was react-native-animated-pagination-dots). Then the app which had this dependency started getting this error, the other app didn't.
This question already has answers here:
internal/modules/cjs/loader.js:883 throw err
(13 answers)
Closed 6 months ago.
I am trying to launch a React project for the first time, but I am running into an error I don't understand.
I made a new React project with create-react-app testreact. That's seems to work fine.
However, when I try to launch it with npm start, I get the following error:
'JavaScript\testreact\testreact\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'C:\Users\Stijn Klijn\Desktop\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Does anyone know what this means? And why is it trying to access a folder on my desktop? (which doesn't exist)
Thanks in advance!
It sounds like react-scripts did not install correctly
In your package.json file, in the dependencies, do you see react-scripts? If you do, try to delete your node_modules folder and run npm i again. If not, try running npm uninstall react-scripts and then npm install react-scripts
I am currently learning react, and started a new app with create-react-app.
I navigated into the new app, then ran npm start.
I got this error message:
Error: Cannot find module '~/Desktop/forms-test/node_modules/postcss-safe-parser/node_modules/postcss/lib/tokenize'
at createEsmNotFoundErr (internal/modules/cjs/loader.js:907:15)
at finalizeEsmResolution (internal/modules/cjs/loader.js:900:15)
at resolveExports (internal/modules/cjs/loader.js:432:14)
at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
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> (~/Desktop/forms-test/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
Any help would be very useful.
I am running Mac OS Catalina, using npm, and running zsh. I am using node version 14.13.1
For others digging around, I followed the instructions on this answer.
rm yarn.lock
yarn install
And that reinstalled everything and properly exported the lib/tokenize path inside of node_modules/postcss-safe-parser/node_modules/postcss/package.json.
I'm trying to debug my app. In the past everything worked perfectly. Then I formatted the computer, downloaded the project I had saved from git.
At this point, every time I try to run npm start in the terminal or to use the react native tool of visual studio code to debug the app or in any case to update the app connected to my device I get this error:
Error: Cannot find module '/Users/..../node_modules/#react-native-community/cli/build/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:338:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:719:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1072:27)
at Function.Module._load (internal/modules/cjs/loader.js:928:27)
at Module.require (internal/modules/cjs/loader.js:1145:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (/Users/.../node_modules/react-native/cli.js:12:11)
at Module._compile (internal/modules/cjs/loader.js:1256:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
at Module.load (internal/modules/cjs/loader.js:1105:32) {
code: 'MODULE_NOT_FOUND',
path: '/Users/..../node_modules/#react-native-community/cli/package.json',
requestPath: '#react-native-community/cli'
I don't understand how can I do.
I remember that before when I made a change to the code I just needed to run npm start to reload my project and see the changes in my device. Now I absolutely can't get the code and device to interact.
How can I do?
You try reinstall React LI:
npm install –g react-native-cli
and install dependences:
npm install