Sick Gaming
Workaround for Bower Version Deprecation - Printable Version

+- Sick Gaming (https://www.sickgaming.net)
+-- Forum: Programming (https://www.sickgaming.net/forum-76.html)
+--- Forum: C#, Visual Basic, & .Net Frameworks (https://www.sickgaming.net/forum-79.html)
+--- Thread: Workaround for Bower Version Deprecation (/thread-85542.html)



Workaround for Bower Version Deprecation - xSicKxBot - 07-06-2018

Workaround for Bower Version Deprecation

<div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/07/workaround-for-bower-version-deprecation.png" width="897" height="434" title="" alt="" /></div><div><p>As of June 25, the version of Bower shipped with Visual Studio was deprecated, resulting in Bower operations failing when run in Visual Studio. If you use Bower, you will see an error something like:</p>
<p><code>EINVRES Request to https://bower.herokuapp.com/packages/bootstrap failed with 502</code></p>
<p>This will be fixed in Visual Studio 15.8. In the meantime, you can work around the issue by using a new version of Bower or by adding some configuration to each Bower project.</p>
<h4>The Issue</h4>
<p>Some time, ago Bower switched their primary registry feed but continued to support both. On June 25th, they turned off the older feed, which the copy in Visual Studio tries to use by default.</p>
<h4>The Fix</h4>
<p>There are two options to fix this issue:</p>
<ol>
<li>Update the configuration for each Bower project to explicitly use the new registry: https://reigstry.bower.io</li>
<li>Manually install a newer version of Bower and configure Visual Studio to use it.</li>
</ol>
<p><b>Workaround 1: Define the new registry entry in the project’s Bower config file (.bowerrc)</b></p>
<p>Add a .bowerrc file to the project (or modify the existing .bowerrc) with the following content:</p>
<pre><code>{ "registry": "https://registry.bower.io"
}</code></pre>
<p>With the registry property defined in a .bowerrc file in the project root, Bower operations should run successfully on the older versions of Bower that shipped with Visual Studio 2015 and Visual Studio 2017.</p>
<p><b>Workaround 2: Configure Visual Studio to point to use a newer version of Bower</b></p>
<p>An alternative solution is to configure Visual Studio use to a newer version of Bower that you have installed as a global tool on your machine. (For instructions on how to install Bower, refer to the guidance on the <a href="https://bower.io/">Bower website</a>.) If you have installed Bower via npm, then the path to the bower tools will be contained in the system $(PATH) variable. It might look something like this: <code><span>C:\Users\[username]\AppData\Roaming\npm</span></code>. If you make this path available to Visual Studio via the External Web Tools options page, then Visual Studio will be able to find and use the newer version.</p>
<p>To configure Visual Studio to use the globally installed Bower tools:</p>
<ol>
<li>Inside Visual Studio, open Tools-&gt;Options.</li>
<li>Navigate to the <strong>External Web Tools</strong> options page (under <em>Projects and Solutions-&gt;Web Package Management</em>).</li>
<li>Select the “$(PATH)” item in the <strong>Locations of external tools</strong> list box.</li>
<li>Repeatedly press the <strong>up-arrow button</strong> in the top right corner of the Options dialog until the $(PATH) item is at the <strong>top of the list</strong>.</li>
<li>Press <strong>OK</strong> to confirm the change.</li>
</ol>
<p><a href="http://www.sickgaming.net/blog/wp-content/uploads/2018/07/workaround-for-bower-version-deprecation.png"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/07/workaround-for-bower-version-deprecation.png" alt="Configure External Web Tools Path" width="897" height="434" class="alignnone size-full wp-image-14205" /></a><br />Ordered this way, when Visual Studio is searching for Bower tools, it will search your system path first and should find and use the version you installed, rather than the older version that ships with Visual Studio in the $(VSINSTALLDIR)\Web\External directory.</p>
<p><strong>Note:</strong> This change affects path resolution for all external tools. So, if you have Grunt, Gulp, npm or any other external tools on the system path, those tools will be used in preference to any other versions that shipped with VS. If you only want to change the path for Bower, leave the system path where it is and add a new entry at the top of the list that points to the instance of Bower installed locally. It might look something like this: <code>C:\Users\[username]\AppData\Roaming\npm\node_modules\bower\bin</code></p>
<p>We trust this will solve any issues related to the recent outage of the older bower registry. If you have any questions or comments, please leave them below.</p>
<p>Happy coding!</p>
<p><strong>Justin Clareburt, Senior Program Manager, Visual Studio</strong></p>
<p><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/07/workaround-for-bower-version-deprecation.jpg" alt="Justin Clareburt (justcla) Profile Pic" width="203" height="209" /> Justin Clareburt is the Web Tools PM on the Visual Studio team. He has over 20 years of Software Engineering experience and brings to the team his expert knowledge of IDEs and a passion for creating the ultimate development experience.</p>
<p>Follow Justin on Twitter <a href="https://twitter.com/justcla78">@justcla78</a></p>
<p> </p>
</div>