felixrieseberg / windows-build-tools

:package: Install C++ Build Tools for Windows using npm
MIT License
3.4k stars 237 forks source link

Error: EBUSY: resource busy or locked #119

Open MAJIDNISAR opened 6 years ago

MAJIDNISAR commented 6 years ago

i am trying to install the windows build tools and i am getting : npm install --global --production windows-build-tools > windows-build-tools@3.0.0 postinstall C:\Users\ThunderEmperor\AppData\Roaming\npm\node_modules\windows-build-tools > node ./dist/index.js Downloading BuildTools_Full.exe [> ] 0.0% (0 B/s) Downloaded BuildTools_Full.exe. Saved to C:\Users\ThunderEmperor.windows-build-tools\BuildTools_Full.exe. Starting installation... { Error: EBUSY: resource busy or locked, unlink 'C:\Users\ThunderEmperor.windows-build-tools\build-tools-log.txt' at Object.fs.unlinkSync (fs.js:1047:3) at files.forEach (C:\Users\ThunderEmperor\AppData\Roaming\npm\node_modules\windows-build-tools\dist\utils\clean.js:13:16) at Array.forEach () at Object.cleanExistingLogFiles (C:\Users\ThunderEmperor\AppData\Roaming\npm\node_modules\windows-build-tools\dist\utils\clean.js:11:11) at Object.install (C:\Users\ThunderEmperor\AppData\Roaming\npm\node_modules\windows-build-tools\dist\install\index.js:27:13) at C:\Users\ThunderEmperor\AppData\Roaming\npm\node_modules\windows-build-tools\dist\start.js:17:19 at Promise.all.then (C:\Users\ThunderEmperor\AppData\Roaming\npm\node_modules\windows-build-tools\dist\download.js:18:21) at process._tickCallback (internal/process/next_tick.js:68:7) errno: -4082, syscall: 'unlink', code: 'EBUSY', path: 'C:\Users\ThunderEmperor\.windows-build-tools\build-tools-log.txt' } + windows-build-tools@3.0.0 updated 1 package in 22.066s

coleherzer commented 6 years ago

I ran into this too and needed to close out the window and restart my computer in order to fix this. It happens whenever you cancel the process in npm install --g --production windows-build-tools

MAJIDNISAR commented 6 years ago

thanks i tried but it is showing me this and not proceeding any further i am stuck please help

G:\Projects\DOC.IO [dev-2 ≡]> npm install --global --production windows-build-tools > windows-build-tools@3.0.0 postinstall C:\Users\ThunderEmperor\AppData\Roaming\npm\node_modules\windows-build-tools > node ./dist/index.js Downloading BuildTools_Full.exe [> ] 0.0% (0 B/s) Downloaded BuildTools_Full.exe. Saved to C:\Users\ThunderEmperor.windows-build-tools\BuildTools_Full.exe. Starting installation... Launched installers, now waiting for them to finish. This will likely take some time - please be patient! ---------- Visual Studio Build Tools ---------- [31D0:0760][2018-06-13T10:08:34]i000: MUX: Creating tree item for the static item not found i---------- Visual Studio Build Tools ---------- [2AA4:1CC0][2018-06-13T10:08:43]i371: Updating session, registration key: SOFTWARE\Microsoft--------------------- Visual Studio Build Tools ---------- [2AA4:1CC0][2018-06-13T10:08:43]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{a9528995-e130-4501-ae19-bbfaddb779cc}, resume: ARP, restart initiated: No, disable resume: No [31D0:0760][2018-06-13T10:08:43]i399: Apply complete, result: 0x0, restart: None, ba requested restart: No ------------------- Python -------------------- Python 2.7.15 is already installed, not installing again.

===================================================== image

coleherzer commented 6 years ago

What version of node are you using?

I was running into a similar issue and eventually solved things and got the install to work properly by using a package called nvm-windows (or just nvm depending on your environment) to run the install using a more stable version of node (suggest something around v8.11.0) and everything went off without any issues.

If that doesn't seem to work I'm not really sure how to help to be honest. Best of luck

godwin-l commented 6 years ago

In Windows 10 64-bit OS, I have resolved this issue by uninstalling Anti-Malware software.

sadegr commented 6 years ago

The error Error: EBUSY: resource busy or locked is most likely due to the fact that the Build Tools installer does not appear to close on its own. When you try to install the npm package a second time, the Build Tools installer still has a lock on the log file. A workaround is to end any Microsoft Visual C++ Build Tools (BuildTools_Full.exe) processes in the Task Manager.

Another workaround for a different issue you're probably experiencing is mentioned by @Philam18 in #116. I am about to submit a pull request to fix this issue.

MAJIDNISAR commented 6 years ago

thankyou guys but resolved the issue of resource busy but it is stuck now on image

sadegr commented 6 years ago

@MAJIDNISAR, we are aware of the issue (the cause is that the Visual Studio Build Tools installer process never exits after installation) but do not have a fix at this time. It should be safe to exit the npm install process once you see successful installation messages for both Visual Studio Build Tools and Python and the All done! message (like you're seeing in your screenshot) - just press Ctrl+C to exit the process once everything is finished installing and you will be returned to a PowerShell prompt.

wqk317 commented 6 years ago

Just delete all the files and repeat them again. image

abettadapur commented 6 years ago

This blocks us from installing build-tools on a VSTS agent, as we cannot restart the machine. Can we come up with another solution?

breekoy commented 5 years ago

I fixed mine by quitting browser_broker.exe in the task manager.

sampathBlam commented 4 years ago

For me, it got fixed by stopping a process called Runtime Broker in Windows task manager.