Working to add Angular (v4) to an existing ASP.NET MVC 4 application. One of the projects it has includes Selenium Web Driver which has a web.config file included.
node_modules\selenium-webdriver\lib\test\data\web.config
This folder is NOT included in the project but is in my web application folder
myapplication\node_modules
myapplication\Controllers
myapplication\Views
myapplication\web.config
etc...
The web.config in the selenium-webdriver folder causes the build to break with the following error:
It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Pretty common error and easily fixed when it is your own mistake, but since this is a library I'm using I don't have control over the file. So my question is a bit leveled based on my research:
- Can I make the "test" folder of selenium-webdriver go somewhere else?
- Should my node_modules folder not be at the root of my web application?
- In general.. how do I fix this?
Its more of a work-around, but my making your node_modules folder hidden it won't show up in your solution explorer and Visual Studio will run your project as normal. As far as I could see, this doesn't affect running your web application.
install the
rimraf
packagethen in
package.json
userimraf
commandPlease note that first time you will have to delete it manually, as the package is already installed and
postinstall
command will not run.But for all your future installs + for your teammates, it will be taken care of automatically as
postinstall
command runs after everynpm install
Please do read more about npm pre & post hooks