Node.js and npm for the Windows Developer

Play Node.js and npm for the Windows Developer

The Discussion

  • User profile image

    My story:

    I'm currently working at a gig using npm, grunt, bower and friends on a large Angular app + WebAPI.

    The front-end guys were Mac-based originally with some PC + VS2013 experience working remotely. They wrote the gruntfile and package.json etc.

    The project has never built on the dev-team's machines. We're all on Windows, AD, group policies and proxy and firewall rules in a financial company.

    We've had the max_path issue, we've continue to have proxy problems, but even with latest npm and using dedupe and being routed directly out to the web, we have issues just with npm package installations failing on "npm install" for reasons we cannot reasonably debug.

    We've so far not been able to get automated build working for the front-end/site. This is obviously a problem for continuous integration and testing.

    I would recommend treading very cautiously if you are to embark on a greenfield website on Windows and are mulling the use of these Linux/Mac technologies.

    I think a major problem is that there are so few people consuming these tools and the packages from Windows that bugs are not found and there's a lack of interest in resolving them for such a small number of "Microsoft" devs.

    Limit the amount of packages you use in the first place. Potentially have the front-end devs have their own gruntfile + packages.json

    I also recommend checking the packages into source control and avoiding "npm install" once you have successfully cached the node_modules locally and deduped to a point where they're all <max_path, else the installers could just stop working at some future point.

    Btw, I had to install Cntlm local proxy to get this to work and even then, some packages seem to call git in such a way that git ignores its own proxy settings. It's hard going and, to my mind, with the features in VS, not really winning us anything yet except that we could work with a "cooler" digital agency for the front-end who like to use Mac.

  • User profile image

    @LukePuplett: Working on a large Angular app as well, and have used both grunt and gulp extensively before. I do have some experience with issues that have been caused by problems during download and unpacking of the npm packages, but they have all been fixed with a cache clean and retries. Many great improvements with npm 3 which is now included with NodeJS 4 and 5.

    So I don't think there is any point in telling others to be "treading very cautiously", that could scare most people away. Microsoft have added support for using npm in both Cordova Apps and in the upcoming ASP.NET 5 projects, as well as Bower (I don't advice anyone to use it, rely only on npm if possible).

    And if someone is reading this, you should not take the advice of checking the node_modules into your source control. Depending on what you are working on, you might be commiting tens of thousands of files with a total size of potentially hundreds of megabytes. We use npm for both gulp tasks and for app client libs, so it's a lot of files. Having those in the source repository would be detrimental to any project, and horrible during updates and upgrades for individual developers.

    While Node.JS did not start out on the Windows platform, it has matured a lot in the recent time and is getting widespread use for both client and server based solutions.

    One important tip: Always use specific version number in package.json, or else you might introduce bugs in production and test environments that you don't have on local machines.

Add Your 2 Cents