1

I am learning react and trying to create react app from command line in windows 10. But it gives an error in middle of the process. Below is the error log.

My node version is v10.8.0 and npm version is 6.2.0

I am using below command to create the app.

D:\react>create-react-app myappreact

Creating a new React app in D:\react\myappreact.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

npm ERR! path D:\react\myappreact\node_modules\.staging\url-parse-6c16a96d\index.js
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\react\myappreact\node_modules\.staging\url-parse-6c16a96d\index.js'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'D:\react\myappreact\node_modules\.staging\url-parse-6c16a96d\index.js']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'D:\react\myappreact\node_modules\.staging\url-parse-6c16a96d\index.js'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'D:\\react\\myappreact\\node_modules\\.staging\\url-parse-6c16a96d\\index.js' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'D:\\react\\myappreact\\node_modules\\.staging\\url-parse-6c16a96d\\index.js\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'D:\\react\\myappreact\\node_modules\\.staging\\url-parse-6c16a96d\\index.js',
npm ERR!   parent: 'myappreact' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
Paul Fisher
  • 9,618
  • 5
  • 37
  • 53
amit rawat
  • 611
  • 1
  • 5
  • 15
  • Which version of node and npm are you using – Hemadri Dasari Aug 25 '18 at 15:48
  • Did you visit this thread https://github.com/npm/npm/issues/18380. It has solution looks like you need to downgrade your npm to 5.3 if you are using 5.4. Check this thread – Hemadri Dasari Aug 25 '18 at 15:50
  • @Think-Twice My node version is v10.8.0 and npm is 6.2.0 – amit rawat Aug 26 '18 at 09:51
  • Have you tried solutions given in the github? – Hemadri Dasari Aug 26 '18 at 09:56
  • @Think-Twice I am looking into that. – amit rawat Aug 26 '18 at 09:58
  • Check this thread as well https://stackoverflow.com/questions/46020018/error-eperm-operation-not-permitted-unlink-d-sources-node-modules-fseven – Hemadri Dasari Aug 26 '18 at 10:00
  • Possible duplicate of [Error: EPERM: operation not permitted, unlink 'D:\Sources\‌\*\*\node\_modules\fsevents\node\_modules\abbrev\package.json'](https://stackoverflow.com/questions/46020018/error-eperm-operation-not-permitted-unlink-d-sources-node-modules-fseven) – Hemadri Dasari Aug 26 '18 at 10:08
  • @Think-Twice I downgraded node to 8.9.4 and npm to 5.3.0. Now when I run create-react-app command to create a react app I get this error "npm ERR! Unexpected end of input at 1:37601 npm ERR! KUj6OKBcR9fQcl1NvUOTWNaJ6mw==","shasum":"49efeea6e8058d5af860a18a6de8" – amit rawat Aug 26 '18 at 10:24
  • Do npm cache clean --force and delete existing project. create new project with create-react-app projectname – Hemadri Dasari Aug 26 '18 at 10:28
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/178793/discussion-between-think-twice-and-amit-rawat). – Hemadri Dasari Aug 26 '18 at 10:31

2 Answers2

1

I had exactly the same problem. I simply turned off my Windows Defender Real-time protection and ran the create-react-app command again, then the problem has been solved.

0

Try deleting all text files on npm-cache logs folder. It worked for me.

C:\Users\yours\AppData\Local\npm-cache\_logs