I am trying to setup a ReactJS app on Windows using the following command:
npx create-react-app my-app
and the output is coming as :
PS C:\Users\santu\React-JS> npx create-react-app my-app
node:fs:1349
handleErrorFromBinding(ctx);
^
Error: EPERM: operation not permitted, mkdir 'my-app'
at Object.mkdirSync (node:fs:1349:3)
at Object.module.exports.makeDirSync (C:\Users\santu\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\mkdirs\make-dir.js:23:13)
at createApp (C:\Users\santu\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:257:6)
at C:\Users\santu\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:223:9
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errno: -4048,
syscall: 'mkdir',
code: 'EPERM',
path: 'my-app'
}
CodePudding user response:
Solution 1
To make this run..You need to run my cmd as an administrator.
So run the below commands:
Run cmd as administrator Run npm config edit (You will get notepad editor) Change prefix variable to C:\Users\<User Name>\AppData\Roaming\npm Then npm start works in a normal console.
OR
Solution 2
Try installing it globally first, using the command
npm install -g create-react-app
And then, you can create your app using the command,
npx create-react-app <Name of your app>
Hope this will help.
Edit: Above solution might work but it's not recommended way of solving this issue. Please refer the Link
I referred to the solution given at the bottom, also some other posts to use the below too:
command: npm config set cache "C:\Users\mycomputer~1name\AppData\Roaming\npm-cache" --global
CodePudding user response:
try to update your npm Using npm@latest command to update the node package manager.
npm install npm@latest -g
after updating your package try
npx create-react-app my-app
you should be able to run without any issues