我正在使用visual studio来开发MVC Angular2项目。
当我更改package.json中的依赖项时,我遇到了错误。主要的一个,我认为是
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.9
以下完整日志。 我一直在尝试通过NuGet包管理器,命令或直接安装来更新它们。 什么都行不通。我仍然有同样的错误,似乎VS2015仍在使用旧版本的Node和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====
答案 0 :(得分:3)
在开发人员工具博客中找到了一个很好的答案: https://blogs.msdn.microsoft.com/webdev/2015/03/19/customize-external-web-tools-in-visual-studio-2015/
由于已经全局安装了所需的node.js版本,我所要做的只是更改外部工具路径的顺序,因此VS将首先搜索$(PATH),并使其看起来像这样: / p>
答案 1 :(得分:1)
您可以更改Visual Studio 2015中的Node.js版本" 工具>选项菜单和项目和解决方案>外部网络工具标签。您应该添加Node.js安装文件夹(例如: C:\ Program Files(x86)\ nodejs )。确保添加的文件夹位于旧版(默认)Node.js文件夹的顶部。最后,它需要重新启动Visual Studio 2015.
有关详细信息,请查看here。