如何更新VS2015中的节点和npm?

我正在使用Visual Studio来开发一个MVC Angular2项目。

当我更改package.json中的依赖项时,出现错误。 主要的,我想是

npm ERR! node -v v0.10.31 npm ERR! npm -v 1.4.9 

下面的完整日志。 我一直试图通过NuGet包pipe理器,命令或直接安装更新。 没有任何工作 我仍然有同样的错误,似乎VS2015仍然使用旧版本的节点和NPM。

如何解决这个问题呢?

谢谢,

斯特凡。

 npm WARN package.json aspnet@0.0.0 No repository field. npm http GET https://registry.npmjs.org/http-server npm http GET https://registry.npmjs.org/ie-shim npm http GET https://registry.npmjs.org/jasmine-core npm http GET https://registry.npmjs.org/rxjs npm http GET https://registry.npmjs.org/zone.js npm http GET https://registry.npmjs.org/angular/compiler npm http GET https://registry.npmjs.org/angular/http npm http GET https://registry.npmjs.org/angular/platform-browser npm http GET https://registry.npmjs.org/angular/common npm http GET https://registry.npmjs.org/angular/platform-server npm http GET https://registry.npmjs.org/angular/platform-browser-dynamic npm http GET https://registry.npmjs.org/angular/core npm http GET https://registry.npmjs.org/angular/router npm http 304 https://registry.npmjs.org/http-server npm http 304 https://registry.npmjs.org/jasmine-core npm http 304 https://registry.npmjs.org/rxjs npm http 304 https://registry.npmjs.org/zone.js npm http 304 https://registry.npmjs.org/ie-shim npm http 404 https://registry.npmjs.org/angular/common npm ERR! 404 Not Found npm ERR! 404 npm ERR! 404 'angular/common' is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 It was specified as a dependency of 'aspnet' npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, or http url, or git url. npm ERR! System Windows_NT 6.2.9200 npm ERR! command "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\Extensions\\Microsoft\\Web Tools\\External\\\\node\\node" "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\Extensions\\Microsoft\\Web Tools\\External\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! cwd C:\Users\plach\Documents\Visual Studio 2015\Projects\Angular2Mvc5Application1\Angular2Mvc5Application1 npm ERR! node -v v0.10.31 npm ERR! npm -v 1.4.9 npm ERR! code E404 npm http 404 https://registry.npmjs.org/angular/compiler npm http 404 https://registry.npmjs.org/angular/http npm http 404 https://registry.npmjs.org/angular/platform-browser npm http 404 https://registry.npmjs.org/angular/platform-server npm http 404 https://registry.npmjs.org/angular/core npm http 404 https://registry.npmjs.org/angular/platform-browser-dynamic npm http 404 https://registry.npmjs.org/angular/router npm ====npm command completed with exit code 1==== 

您可以从“ 工具”>“选项”菜单和“ 项目和解决scheme”>“外部Web工具”选项卡更改Visual Studio 2015的Node.js版本。应添加Node.js intallation文件夹(例如: C:\ Program Files(x86)\ nodejs )确保你添加的文件夹位于较旧的Node.js文件夹的最前面,最后需要重新启动Visual Studio 2015。

欲了解更多详情,你可以在这里查看

在开发者工具博客中find了一个很好的答案: https : //blogs.msdn.microsoft.com/webdev/2015/03/19/customize-external-web-tools-in-visual-studio-2015/

由于所需的node.js版本已经全局安装,所以我只需要改变外部工具path的顺序,所以VS会首先search$(PATH),并使其看起来像这样:

外部工具顺序