0

我想在 Visual Studio 2015 中使用最新的 npm。我已经从 Visual Studio 安装程序安装了 Joyent Node。我知道可以单独安装 Node.js,但我们似乎对此有问题,所以我们正试图以“微软方式”做事。我还安装了适用于 Visual Studio 2015 的 Node.js 工具 1.1。在 Visual Studio 的 node.js 交互式窗口中,运行 .npm 会为我提供以下信息:

Specify configs in the ini-formatted file:
    C:\Users\MyUsername\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@2.7.4 C:\Program Files (x86)\nodejs\node_modules\npm
 successfully completed

但是,如果我使用“Node.js 命令提示符”并运行:

npm -g install npm 

它更新 npm 并运行 npm 命令,我得到以下信息:

Specify configs in the ini-formatted file:
    C:\Users\MyUsername\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@3.8.0 C:\Users\MyUsername\AppData\Roaming\npm\node_modules\npm

如果我回到 Visual Studio 2015 Node.js 交互窗口并运行 .npm,我会看到版本没有更改,即使 VS 重新启动也是如此。但是,我遇到了其他用户报告的长文件名问题并且没有问题,所以我相信实际上正在使用 npm 3.8.0,但我不能确定。如何让 Visual Studio 2015 使用最新的 npm 以避免长文件名问题?Node.js 交互窗口在这里有什么相关性吗?谢谢!

4

2 回答 2

1

转到Tools -> Options -> Projects and Solutions -> External Web Tools并添加节点安装的路径。然后将其在依赖项列表中上移。

于 2016-03-10T16:13:07.497 回答
0

在 Node.js 命令提示符下运行 npm-windows-upgrade 并使用路径选项添加它并在 Visual Studio 2015(上图)中为我修复它的路径输出。

http://www.triplet.fi/blog/npm-3-will-bring-brighter-future-for-windows-users/

https://github.com/felixrieseberg/npm-windows-upgrade

于 2016-03-10T17:41:54.920 回答