<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael Wilkinson</title>
    <description>The latest articles on DEV Community by Michael Wilkinson (@michaelwdev).</description>
    <link>https://dev.to/michaelwdev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F752665%2Fe8f7db31-7b8a-4ddd-9127-dec6ef4f50eb.jpg</url>
      <title>DEV Community: Michael Wilkinson</title>
      <link>https://dev.to/michaelwdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/michaelwdev"/>
    <language>en</language>
    <item>
      <title>Installing NVM on Windows 11</title>
      <dc:creator>Michael Wilkinson</dc:creator>
      <pubDate>Wed, 02 Mar 2022 17:32:38 +0000</pubDate>
      <link>https://dev.to/michaelwdev/installing-nvm-on-windows-11-ehg</link>
      <guid>https://dev.to/michaelwdev/installing-nvm-on-windows-11-ehg</guid>
      <description>&lt;h1&gt;
  
  
  Wrong Version of Node? What??
&lt;/h1&gt;

&lt;p&gt;Picture a familiar scene to the JavaScript developer; a new project comes in and you reach for your favourite framework and "npm install" this or "npx create..." that and BOOM! You get an error message informing you that you have the wrong version of Node installed. Why?! This is because you are also working on an older project that requires you to use a particular version of Node so you can serve the project locally when coding on it. So, now what?&lt;/p&gt;

&lt;h3&gt;
  
  
  NVM to the rescue...right?
&lt;/h3&gt;

&lt;p&gt;If you're a developer and your daily machine is a Mac or a Linux box and using anything to do with JavaScript, then there is a very good chance you've heard of NVM...or Node Version Manager to use it's full name. You will freely be able to use many different versions of Node on your machine and it wont impact your workflow in the slightest. If you have never heard of NVM, then you're either not a frontend JavaScript developer or you've been missing out. However...what if your machine is running Microsoft Windows? The NVM that Mac and Linux users love and use daily, wont work on Windows. End of story. So what do we need?&lt;/p&gt;

&lt;h3&gt;
  
  
  NVM For Windows
&lt;/h3&gt;

&lt;p&gt;Thankfully, there is a shining light for all developers using Windows. A very thoughtful chap called &lt;a href="https://twitter.com/goldglovecb"&gt;Corey Butler&lt;/a&gt; has built a version of NVM for those of us using Windows machines as part of our development toolset. Thank you Corey for your efforts and for making my life a lot easier!&lt;/p&gt;

&lt;h2&gt;
  
  
  How To Install NVM on Windows
&lt;/h2&gt;

&lt;p&gt;If you've come this far, this is probably what you're looking for. So without me waffling on any longer, hopefully this will help someone out there.&lt;/p&gt;

&lt;p&gt;After starting a new Azure Function, I was met with error messages telling me I had the wrong Node version. This was a new machine, so after checking my version, I actually had none installed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zg6Kce6f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646239591541/pe-cDsEWK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zg6Kce6f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646239591541/pe-cDsEWK.png" alt="1.node-missing-crop.png" width="880" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First of all, we need to grab a release of NVM Windows so we can install it. To do that, head to &lt;a href="https://github.com/coreybutler/nvm-windows/releases"&gt;here&lt;/a&gt;, which is Corey's GitHub releases page to get the latest version, and download 'nvm-setup.zip'. After extracting the contents, you'll have this little beauty all ready to be run:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XAyZDowy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646240176786/TNko7XnGQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XAyZDowy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646240176786/TNko7XnGQ.png" alt="2.downloaded.png" width="341" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Double-click it to start the install process and follow the instructions...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2lrXRIwC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646240306085/x7qs_tRP3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2lrXRIwC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646240306085/x7qs_tRP3.png" alt="3.install.png" width="580" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once installed, open a terminal and at the prompt type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the installation completed successfully, you'll see something very similar to this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bNY-qcaM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646240502181/Dd5GSUL8j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bNY-qcaM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646240502181/Dd5GSUL8j.png" alt="4.nvm-usage.png" width="880" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Success! It's all looking very nice indeed. Now we have the version manager, we need to actually install Node. So with our terminal still open, we can grab the current 'Long Term Support' version by entering:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm install lts

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will download, extract and install the 'LTS' version of Node and will even inform you of what to enter to use the newly installed version:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PXYxCu2Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646240754344/UX2L-6gY2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PXYxCu2Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646240754344/UX2L-6gY2.png" alt="5.installing-node-lts.png" width="880" height="543"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now when I go back to my terminal from earlier, I list my versions of node installed, enter which version to switch to and verify just to make sure:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VldWYqz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646241164690/7R4MO3xlY.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VldWYqz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1646241164690/7R4MO3xlY.png" alt="6.first-nvm-use-crop.png" width="880" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  I need a different version of Node
&lt;/h3&gt;

&lt;p&gt;So what happens when you get to work on another project and lets pretend it's a legacy project from a few years back. You clone the latest code from your repository and a previous developer has kindly stated in the ReadMe file that you need Node version 12.13.1 to be able to serve the application. Now you have NVM Windows installed, this is nice and easy using 'nvm install' and 'nvm use':&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm install 12.13.1
nvm use 12.13.1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note that you need to have the exact Node version number or it will fail.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now to verify, enter this in to the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node -v

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...and you'll see that you're now using Node version 12.13.1. If you need to see all the versions you have installed for when you need to switch again, just enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm list

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...and you have everything you need ready to switch to the correct version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank You Corey
&lt;/h2&gt;

&lt;p&gt;Just to re-iterate what I said above, we need to thank Corey Butler for his excellent work and effort on building this for us Windows users. No longer can the developers on Mac and Linux look down their noses and scoff at us for not being able to manage our Node versions with ease like they can. Now they'll have to find something else to scoff at!&lt;/p&gt;

</description>
      <category>windows</category>
      <category>node</category>
      <category>nvm</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Microsoft WebView2 blank or not working?</title>
      <dc:creator>Michael Wilkinson</dc:creator>
      <pubDate>Sun, 19 Dec 2021 15:01:34 +0000</pubDate>
      <link>https://dev.to/michaelwdev/microsoft-webview2-blank-or-not-working-1h1e</link>
      <guid>https://dev.to/michaelwdev/microsoft-webview2-blank-or-not-working-1h1e</guid>
      <description>&lt;h2&gt;
  
  
  WebView2? What is that?
&lt;/h2&gt;

&lt;p&gt;Microsoft announced a new control called 'Microsoft Edge WebView2' on October 19th 2020 (official article &lt;a href="https://blogs.windows.com/msedgedev/2020/10/19/edge-webview2-general-availability/"&gt;here&lt;/a&gt;) to allow a developer to display content from the web in their native Windows desktop application and to create entire desktop applications built with web technologies.&lt;/p&gt;

&lt;p&gt;This new embedded web control is built on top of Microsoft Edge, the newer Chromium edition. When this was announced, there were many comments about how this could cause a dent in the &lt;a href="https://www.electronjs.org/"&gt;Electron&lt;/a&gt; market, particularly for products that only target Windows at the moment. With multi-platform developer goodies from Microsoft (&lt;a href="https://docs.microsoft.com/en-us/dotnet/maui/what-is-maui"&gt;.NET MAUI&lt;/a&gt;) on the way, whose to say this wont make Electron sit up and notice.&lt;/p&gt;

&lt;p&gt;Currently, if you're building Windows apps with Win32, WPF, WinForms, WinUI 2 or WinUI 3, then you can use this control in your nice new desktop app, or even add it to an existing one as a nice feature addition.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's not working!
&lt;/h2&gt;

&lt;p&gt;So, after the initial excitement of using this nice new control and see web content in your desktop app in all it's glory, suddenly you notice something a little strange in it's behaviour. Out of seemingly nowhere, it stops working. Your lovely content from the web is suddenly replaced with a blank void. Is it something you've changed? Has your code stopped it from working? Is the web content running some nasty script causing it to stop working? Well, possibly. There is however another reason and it might not be your fault at all.&lt;/p&gt;

&lt;p&gt;After working with this control in an evaluation WinUI 3 app, I started to experience the sudden blank content. After a lot of head scratching and debugging, I just couldn't work out what the problem was. So I did the sensible thing and walked away from it with the plan to come back to it the following day. That day came...and it all worked perfectly. Although happy, this made me even more suspicious. This just doesn't happen in software development as we all know! Later that day, it stopped working again. I decided to close all other applications I had open to give it my full attention and it started working again! I haven't got much hair to pull out and my receding locks were starting to look worried.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Bring out the GIMP&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I'm not talking about Pulp Fiction here, I am of course talking about the excellent &lt;strong&gt;G&lt;/strong&gt;NU &lt;strong&gt;I&lt;/strong&gt;mage &lt;strong&gt;M&lt;/strong&gt;anipulation &lt;strong&gt;P&lt;/strong&gt;rogram (&lt;a href="https://www.gimp.org/"&gt;gimp.org&lt;/a&gt;). &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d3niWYsG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642424119116/6e_Te4Ph9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d3niWYsG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642424119116/6e_Te4Ph9.png" alt="wilber_med.png" width="64" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wilber is looking very happy right there, but it seems that when GIMP is loaded, it's stopping the WebView2 control from working properly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Proof
&lt;/h2&gt;

&lt;p&gt;I downloaded the WinUI 3 Controls Gallery from Microsoft that is a really nice little app that shows off the WinUI 3 controls all in one place. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iPQG2Aet--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642424623931/i4LjIXUUD.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iPQG2Aet--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642424623931/i4LjIXUUD.png" alt="winUI3-opening.png" width="880" height="821"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the Media dropdown menu item, you can select a WebView2 page that displays an example of the control performing in all its glory: &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G4wDo0XZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642424791914/eXLuRoVcK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G4wDo0XZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642424791914/eXLuRoVcK.png" alt="winUI3-webview.png" width="880" height="792"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, after loading GIMP this is what happens to the WebView2 control:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FVz16gUU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642430091862/6gIIoVUD1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FVz16gUU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1642430091862/6gIIoVUD1.png" alt="winUI3-webview-broke.png" width="880" height="713"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The control will no longer display any web content at all and remains blank apart from the 'WebView2 is powered by the Chromium engine' text you can see at the top of the controls viewport. On some occasions when opening the gallery app, it crashes instantly and then closes if GIMP is already loaded. This behaviour however is not consistent.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what's the fix?
&lt;/h2&gt;

&lt;p&gt;Unfortunately, at the time of writing this there is no fix. The only consistency with it, is the control stops working no matter if you're running the app in debug mode from Visual Studio or from a compiled production version of your app. In a nutshell, it stops working everywhere. There is an open issue on &lt;a href="https://github.com/microsoft/microsoft-ui-xaml/issues/4794#issuecomment-994765513"&gt;GitHub&lt;/a&gt; that I have added my feedback to that suggests the same behaviour occurs with Inkscape as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Should I be using this then?
&lt;/h2&gt;

&lt;p&gt;Well that's the big question. If you're creating an app to be used in your company where you can be sure GIMP or Inkscape or not being used, then there is no reason not to use it. For an app that will be on general release is a higher risk as you'll have no idea what your users will be running. I would never say you &lt;em&gt;shouldn't&lt;/em&gt; be using it, but if the risks are too high, then I would personally wait for a fix to come along.&lt;/p&gt;

&lt;p&gt;All this of course means that Electron is still the King when it comes to producing desktop applications created with web technologies and will be for a while I believe. WinUI 3 from Microsoft does look really nice and will definitely be used heavily in companies in the real World, but possible with the WebView2 control being avoided for a wee while...&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>winui</category>
      <category>webview2</category>
      <category>desktop</category>
    </item>
  </channel>
</rss>
