Why I am getting this error message when I run react js project first time in my system?

Viewed 44728
  1. When I run npm start, I get this error message:

Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys' Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\pagefile.sys' Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\swapfile.sys' Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys' Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\pagefile.sys' Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\swapfile.sys' Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys' Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\pagefile.sys' Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\swapfile.sys'

13 Answers

follow the below steps:

  1. Delete node_modules folder.
  2. run npm install .
  3. run npm cache clean .

*first 2 steps worked for me.

Delete node_modules folder and then run:

npm install && npm clean-install react-scripts

I fixed this issue by installing the chart.js: 2.5.0 dependency. The issue with my code is that I was using react-chartjs-2 dependency and in order to use it, I needed to install chart.js.

Note that I had to install it manually. npm i wasn't working. Hope it helps.

running

npm install --cache /tmp/empty-cache

Solves the problem for me.

I faced the same problem. Then I was importing a package that I didn't yet install. So make sure you have installed all the packages that you are using in the import statements at the top of your React component.

I had the same problem with nativscript/angular router.

Problem was bad import. I mean deep import like @nativescript/angular/router.

I changed it to @nativescript/angular because there is no more deep imports.

Maybe it is a similar problem with your react-router.

I had the same issue. You're probably working in a Linux environment. If it is so, before running the start script, you need to switch the terminal to sudo user.

This approach fixed my issue.

Deleted all my node modules and reinstalled, worked for me

On Arch Linux just run:

rmdir -rf node_modules
sudo pacman -S npm
npm install -g semver
sudo pacman -Sy node-gyp

deleting node_modules folder and then running:

npm install
npm cache clean

worked for me!

Delete all node_modules and check npmrc file whether it's there in C:\Users<username> folder or not. If not, then create it and again do npm install followed by npm cache clean and npm run start.

I am using Yarn rather than npm

  1. Delete the node_modules folder
  2. yarn add
  3. npm cache verify
Related