18

I know that this was asked before, but I still can't fix my problem. I am still a novice and just learning Javascript currently. And when I tried to save my files yesterday I got this error : EBUSY: resource busy or locked, open 'C:\Users\User\Desktop\Practicing environment\index.html' I have no idea that means. I tried to restart my laptop and it worked for around 5 minutes at max. I can't keep on learning if I can't save it.

I tried to change IDE from Atom to Brackets and vice versa, still got the same error when I am trying to save my code.

Screenshot

Community
  • 1
  • 1
user3937122
  • 191
  • 1
  • 1
  • 6

14 Answers14

24

So I'm a little late to the game here...4 years late, but this solution should work.

So this issue is arising because another program has that file open and could change its contents at any time (theoretically) and so your Operating System won't let you try to make changes too. This is typical to all OS's. You wouldn't want multiple copies of the same file open with different programs, because then you wouldn't really know which copy is the file of truth, or how to merge the changes properly, etc. Essentially you need to stop the program that is currently using that file so that you can read/write to it.

Anyways. If anyone looking for an answer here is using a Linux/Unix based OS, refer to this post.

If you're running into this issue on a Mac, the post above may work for you also since OSX is Unix based.

SOLUTION

If you're on Windows 10 (might work for older versions), you can just go to the file location in the file explorer, and try to move it to another folder. Don't try to delete it because it might actually work, but moving it should bring up a popup saying "File In Use" looking like this:

File In Use

So the popup here says "the file is open in Java(TM) Platform SE Binary". That's your ticket.

Now go into Task Manager (Ctrl + Shift + ESC in Windows), and find and select the program has the file open, and click 'End Task'. Now you should be free to use/alter/run the file that you couldn't before.

Also, in the end restarting your computer will do the same thing generally. But this is faster IMO.

Hope this helps some people. Cheers.

Devin Carpenter
  • 907
  • 8
  • 21
5

For me, copying the contents of the file into a new file, and then deleting the original file, works to resolve these kinds of errors. After you've deleted the file, create a new one with the same name, and paste back in the content.

If the file is auto-generated (for example, Typescript output) then just deleting the file works.

Bryan Rayner
  • 4,172
  • 4
  • 26
  • 38
5

Open your IDE as a Administrator, It seems you dont have permission to operate.

Ignatius Andrew
  • 8,012
  • 3
  • 54
  • 54
4

TO find out which process is locking this file/folder under Windows 10:

Use resmon.exe included in Windows (exec resmon.exe from the start menu):

  1. Open Resource Monitor, which can be found By searching for Resource Monitor or resmon.exe in the start menu, or As a button on the Performance tab in your Task Manager
  2. Go to the CPU tab Use the search field in the Associated Handles section See blue arrow in screen shot below When you've found the handle, you can identify the process by looking at the Image and/or PID column.
  3. You can then try to close the application as you normally would, or, if that's not possible, just right-click the handle and kill the process directly from there. Easy peasy!

screenshot

Original answer : https://superuser.com/questions/117902/find-out-which-process-is-locking-a-file-or-folder-in-windows

Daniel
  • 807
  • 8
  • 24
2

Restarting Laptop would help in stopping the resources from it's link (In Windows)

1

For locked files, you can use Unlocker programs like IObit Unlocker.

After installing, right click on the file and choose IObit Unlocker, then click on Unlock. It should work afterwards.

yazantahhan
  • 2,950
  • 1
  • 13
  • 16
0

This can very likely be due to having spaces or special characters in your file path. Make sure to replace spaces with dashes in your path. This made it work for me.

Abdurrahman
  • 181
  • 2
  • 7
0

It means it is time to turn your machine off and then turn it on again).

Roman Yakoviv
  • 1,614
  • 15
  • 19
0

Got this when trying to run yarn install. I deleted the "yarn.lock" file and ran yarn install again. The error didn't show up again.

Amrita Yadav
  • 95
  • 1
  • 8
0

This also happens if the file you're trying to modify is already opened by another program

Peter Moses
  • 1,997
  • 1
  • 19
  • 22
0

It"s resolved for me with this way:

my file in that Path is not in use.

I go to dist folder of output my project, and remove output folder physically.

then this error resolved.

AminRostami
  • 2,585
  • 3
  • 29
  • 45
0

I was having same issue in my nodejs app. I was using puppeteer for creating pdf files. On 1st hit, pdf was successfully generated and I opened it to check all the content. I ran into this issue. On closing opened pdf file, Issue is resolved.

ImFarhad
  • 2,669
  • 2
  • 18
  • 30
0

Here's The Final Solution if you're on windows:

  1. Check if any program is using it and close them.

  2. MAKE SURE YOUR PATHS ARE VALID console log the paths that you're passing to your functions make sure they're correct. In my situation I was passing folder path instead of a file.

-1

I have found that, in Angular projects, running build from src folder, and not from other internal folders, like src/app/...., will help to reduce the issue.

DarkMukke
  • 2,469
  • 1
  • 23
  • 31