i have this error wher i try to create react project

77 views Asked by At

I have this error wher i try to create react project

$ npx create-react-app my-app

npm ERR! code ENOENT

npm ERR! syscall spawn C:\Program Files\MongoDB\mongosh-2.0.1-win32-x64\bin

npm ERR! path C:\Users\SamCro\Desktop\PRJS\Ang

npm ERR! errno -4058

npm ERR! enoent spawn C:\Program Files\MongoDB\mongosh-2.0.1-win32-x64\bin ENOENT

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\SamCro\AppData\Local\npm-cache\_logs\2024-02-08T18_44_21_764Z-debug-0.log

I tried to update npm and reinstall Node.js and MongoDB

2

There are 2 answers

2
Rohit Khandelwal On

I suggest you use Vite instead of CRA(create-react-app). These are a few of the following big reasons out of many:

  • CRA is no longer updated|maintained by the community. React's official docs don't suggest CRA for new projects anymore. CRA's last release.

  • Vite provides hot-module-reload in the dev env while CRA recompiles the complete build. Saving huge dev hours

  • Vite uses rollup to bundle the code. Rollup is more efficient than the webpack in optimized bundling.

    npm create vite@latest my-app -- --template react
    
0
yasith On

ENOENT error particularly related to MongoDB.This issue might be occurring because npm is unable to find the specified executable file in the path provided. In addtion make sure MongoDB Path in System Environment Variable.