如何在VS2015中禁用“npm install”

时间:2022-07-27 19:08:50

In VS2015, opening a web project/solution that uses node packages (e.g. gulpfile.js) will cause VS to automatically run "npm install" and install all the packages. VS2015 comes with an old version of npm (1.4.19), which doesn't do a "flat" install of package dependencies, which causes paths to get created that are over 260 characters. This is really painful when it happens every time Visual Studio is opened. I've found several workarounds (including http://jameschambers.com/2015/09/upgrading-npm-in-visual-studio-2015/), but ideally there would be a setting somewhere to disable "auto npm install" or something like that, I just either can't find the setting or it doesn't exist.

在VS2015中,打开使用节点包(例如gulpfile.js)的Web项目/解决方案将导致VS自动运行“npm install”并安装所有包。 VS2015附带了旧版本的npm(1.4.19),它不会对包依赖关系进行“平面”安装,这会导致创建超过260个字符的路径。每次打开Visual Studio时都会发生这种情况非常痛苦。我找到了几个解决方法(包括http://jameschambers.com/2015/09/upgrading-npm-in-visual-studio-2015/),但理想情况下会有某个设置禁用“auto npm install”或类似的东西,我要么找不到设置,要么就不存在。

1 个解决方案

#1


1  

You can literally "hide" all web tools from Visual Studio:

您可以从Visual Studio中“隐藏”所有Web工具:

  1. Under Tools menu select "Options..."
  2. 在工具菜单下选择“选项...”
  3. Go to "Projects and Solutions" -> "External Web Tools"
  4. 转到“项目和解决方案” - >“外部Web工具”
  5. If you want to make Visual Studio use your globally installed npm - just remove checkboxes from all items starting with $(DevEnvDir).
  6. 如果要使Visual Studio使用全局安装的npm - 只需删除以$(DevEnvDir)开头的所有项目的复选框。
  7. If you want to completely disable all web tools in VS: uncheck all.
  8. 如果要完全禁用VS中的所有Web工具:取消选中全部。

#1


1  

You can literally "hide" all web tools from Visual Studio:

您可以从Visual Studio中“隐藏”所有Web工具:

  1. Under Tools menu select "Options..."
  2. 在工具菜单下选择“选项...”
  3. Go to "Projects and Solutions" -> "External Web Tools"
  4. 转到“项目和解决方案” - >“外部Web工具”
  5. If you want to make Visual Studio use your globally installed npm - just remove checkboxes from all items starting with $(DevEnvDir).
  6. 如果要使Visual Studio使用全局安装的npm - 只需删除以$(DevEnvDir)开头的所有项目的复选框。
  7. If you want to completely disable all web tools in VS: uncheck all.
  8. 如果要完全禁用VS中的所有Web工具:取消选中全部。