Just faced an unexpected problem in my ASP.NET Core project. Here is the deal, I've added CLI tool for Angular2 support exactly to the web project. I know it's a good practice to separate frontend and backend, but in my view, it's acceptable to deliver them as a single unit for simplicity purposes sometimes.

The problem arose right after installing CLI tool for Angular2. I kept getting the following error during backend compilation:

Wow, the fact that that node_modules can contain server-side code was a surprise for me, frankly. Well going into node_modules to compile something out there was a behavior I didn't expect, to be honest. In my particular case the Selenium web driver was causing the issue:

I resolved the issue by letting the compiler know that I want to exclude node_modules folder from the pipeline, by tweaking buildOptions/compile section in project.json file. Like this: