npm install -g create-react-app, Why it is mandatory to write before creating any react project. If I globally install npm then why it is required to install npm another time for another folder or project.
It always shows the below error:-
npm ERR! enoent ENOENT: no such file or directory, open 'E:\AvatarDemo\AvatarDemoAwesome\package.json' 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: npm ERR! C:\Users\NAFFY KAUSAR\AppData\Roaming\npm-cache_logs\2020-06-23T15_12_49_522Z-debug.log PS E:\AvatarDemo\AvatarDemoAwesome> npm install -g create-react-app C:\Users\NAFFY KAUSAR\AppData\Roaming\npm\create-react-app -> C:\Users\NAFFY KAUSAR\AppData\Roaming\npm\node_modules\create-react-app\index.js
- [email protected] updated 1 package in 24.341s npm ERR! code ENOENT npm ERR! syscall open npm ERR! path E:\AvatarDemo\AvatarDemoAwesome\package.json npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, open 'E:\AvatarDemo\AvatarDemoAwesome\package.json' 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: npm ERR! C:\Users\NAFFY KAUSAR\AppData\Roaming\npm-cache_logs\2020-06-23T15_19_27_276Z-debug.log PS E:\AvatarDemo\AvatarDemoAwesome> create-react-app AvatarAwesome
npx create-react-app my-app-name
if you gotnpm install -g create-react-app
from a tutorial then find another one. – HMRnpm install -g create-react-app
before every project; the-g
flag will install the package globally on your machine, so you can easily runcreate-react-app
in any directory without needing to re-install. The general advice is to uninstall this completely however (npm uninstall -g create-react-app
), and instead create new projects by runningnpx create-react-app app-name
so that you are always getting the up-to-date release when setting up a project. – Rees Morris