Visual Studio 2017 外部工具 npm 不工作 [英] Visual Studio 2017 External Tools npm Not working
问题描述
我有一个需要 npm 3+ 的打字稿项目.我已将它安装到 C:\Program Files\nodesjs,并将我的系统环境变量设置为指向那里.
I have a typescript project that requires npm 3+. I've install it to C:\Program Files\nodesjs, and I set my system environment variables to point there.
不过,在 Visual Studio 2017 中,当我设置外部工具位置时,它仍然没有选择 npm 版本 3+.
In visual studio 2017 though, when I set the external tools location, it still doesn't pick up npm version 3+.
推荐答案
向外部工具添加额外路径的方式似乎是正确的.你确定你有正确的版本吗?(在我的安装中,内置的 nodejs 版本是 5.4.1 和 npm verison 3.3.4)
The way you add an extra path to the external tools seems correct. Are you sure you have the correct version there ? (On my installation the built-in nodejs version was 5.4.1 and npm verison 3.3.4)
可以肯定的是,对我来说,找出 Visual Studio 2017 使用的 npm 安装的最佳方法是这个(取自 如何获取 npm 全局路径前缀) :
To be sure, for me the best way to figure out which npm installation Visual Studio 2017 was using is this (taken from How to get the npm global path prefix) :
PM> npm config get prefix
如果其他方法都失败了,你也可以随时更新内置的 npm.只需导航到您的 Web 外部路径(可能是 C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Web\External)和:
And if all else fails, you can always update the built-in npm too. Just navigate to your web external path (probably C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Web\External) and :
pm> npm install npm@latest
这篇关于Visual Studio 2017 外部工具 npm 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!