问题描述
正在将Angular(v4)添加到现有的ASP.NET MVC 4应用程序中.它包含的一个项目包括Selenium Web Driver,其中包含一个web.config文件.
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
此文件夹未包含在项目中,但在我的Web应用程序文件夹中
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...
selenium-webdriver文件夹中的web.config导致构建因以下错误而中断:
The web.config in the selenium-webdriver folder causes the build to break with the following error:
使用注册为
非常常见的错误,很容易解决,这是您自己的错误,但是由于这是我正在使用的库,因此我无法控制该文件.因此,根据我的研究,我的问题得到了解决:
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:
- 我可以将selenium-webdriver的测试"文件夹放到其他地方吗?
- 我的node_modules文件夹是否应该不在我的Web应用程序的根目录下?
- 一般而言.如何解决此问题?
推荐答案
安装rimraf
软件包
npm install rimraf
然后在package.json
中使用rimraf
命令
'script': {
'postinstall': 'rimraf node_modules/**/web.config'
}
请注意,由于该软件包已经安装并且postinstall
命令将无法运行,因此第一次您必须手动将其删除.
Please note that first time you will have to delete it manually, as the package is already installed and postinstall
command will not run.
但是对于您以后为队友安装的所有+,每次npm install
But for all your future installs + for your teammates, it will be taken care of automatically as postinstall
command runs after every npm install
请阅读有关 npm的更多信息前置&张贴钩子
这篇关于node_modules中断了Visual Studio中的构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!