Friday, March 4, 2016

Fixing a npm Package That Will Not Reinstall


Recently when working on an Angular 2 app in VS.NET 2015 using an ASP.NET 5 template I began to see build errors that Angular 2 was missing. 



I was having trouble getting Angular to reinstall no matter which version I selected in my package.json file. It didn't matter if I deleted the local files or npm cache as nothing would work.

Upon inspecting the output I noticed the following errors:


npm ERR! error rolling back  errno: 10,
npm ERR! error rolling back  code: 'EBUSY',



Upon further research and some nudging from the problem on this GitHub link, it appeared a file was locked. The answer -> reboot the Windows machine. This does appear to be a Windows issue with file locking of some file(s) within the npm package and causing the error.

Upon reboot, I right-clicked 'Dependencies' and selected, 'Restore Packages.' Sure enough the Angular 2 npm package reinstalled successfully. Previously the angular2 folder existed but there was nothing inside of it. If you ever have any issues getting a npm package to install, always make sure to read the output in the VS.NET console to shed light on any issues.



No comments:

Post a Comment