A Node.js developer’s feature wish list for Microsoft Windows
Over the past year I’ve been writing a book for Manning publications about building cross platform desktop applications with Node.js, Electron and NW.js. In order to test the book’s application examples on Windows, I purchased an ASUS ZenBook. Having spent the past 8 years working mostly on Mac OS X and a bit on Linux, the experience of working with Windows was quite different, and over time I found myself amassing a list of “if only it has this” items. This blog post is that wish list.
More features for the command line
On Windows there are 2 command line applications: Command Prompt and PowerShell. That said, PowerShell is actually a Command Line Shell with its own scripting language which systems administrators can use to run various tasks.
PowerShell feels like it has a lot of features that Command Prompt ought to have; text selection, being able to run ‘ls’, ‘clear’, and easier copy and paste. Try using Terminal on Mac OS X and then switching to using Command Prompt on Windows — the experience is so distinctly different. It feels like the command line needs a lot more love on Windows. It’s great that Microsoft are bringing bash to Windows (the beta is available to Windows insiders today), but it can’t come soon enough.
I’ve missed being able to log into boxes and push up code in GitHub repositories from the command line. I’ve resorted to using GitHub’s official desktop app to handle pushing code updates from my repositories, but when it comes to needing to access a VPS and tinker with it, I have to use 3rd-party tools like Cwgwin or SSHPutty. Again it comes back to needing to use a 3rd-party tool rather than being able to work with the Operating System’s default tools out of the box.
That said, there is one tool that has been a lifesaver — Scoop. Often likened to being like Homebrew for Windows, Scoop allows you to install software from the command line. Not only that, you can install libraries like grep, which and yes you guessed it, OpenSSH.
For me, discovering Scoop was a major joy, but it would be nice if some of these tools were available in Windows by default, so that new Windows developers could get to work in an instant. It would also add something of a boon for developers who are used to the simplicity of installing software from the command line, much in the same way that Ubuntu Linux users can install packages using apt-get.
The 256 character limit on file paths
The issue I was experiencing was that the desktop application I built worked on Mac OS X and Linux, but not on Windows. It was a puzzling issue as nothing jumped out immediately — there wasn’t an explicit error explaining that the app had tried to load a file whose file path was too long for Windows. It was failing in a silent fashion. I had to use developer tools for the desktop application framework to try and figure out what was going on, only to see certain libraries were not being loaded by the app.
With a bit of googling I was able to establish that I had run into the 256 character limit issue — front-end libraries installed with bower would have their dependencies installed inside of a nested folder, and so on. NPM users have encountered the same issue, leading to the use of installing NPM dependencies in a flat folder structure in version 3 of NPM.
I managed to work around the issue, but it would have been nice if there had been some smart detection that I was attempting to load a file with a file path longer than 256 characters, and thus raise an error somewhere along the stack. Even better, if the 256 character limit could be removed altogether, the better, but that will happen when Win32 legacy compatibility is removed from Windows, as that’s why the current character limit exists.
Microsoft under Satya Nadella is a breathe of fresh air; they’ve made a number of big moves like open-sourcing the .Net framework, acquiring Xamarin, supporting SQL Server on Linux, and getting Bash onto Windows. There is a sense now that Microsoft is truly trying to embrace the development community that has evolved outside of Microsoft’s ecosystem over the past decade and a bit.
I hope that they continue to push further and make Windows a greater platform for Node.js developers to work on. Anyone who remembers Ryan Dahl’s presentation on the sorry state of Windows support for Node.js back in 2011 will be pleased to see how far things have come, but I feel that there are a few rough edges that would go some way to making Windows an ideal platform for Node.js developers, especially those who are developing desktop applications with Node.js given the immense popularity of Electron.