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

时间:2022-04-09 13:46:48

I am using visual studio in order to develop an MVC Angular2 project.

我正在使用visual studio来开发MVC Angular2项目。

When I change a dependencies in package.json, I got errors. The main one, I think is

当我在package.json中更改依赖项时,我遇到了错误。主要的一个,我认为是

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

Full log below. I have been trying to update both via the NuGet Package Manager, the command or direct install. Nothing works. I still have the same error and it seems that VS2015 is still using old version of Node and NPM.

完整日志如下。我一直在尝试通过NuGet包管理器,命令或直接安装来更新它们。什么都行不通。我仍然有相同的错误,似乎VS2015仍在使用旧版本的Node和NPM。

How to solve this problem?

如何解决这个问题呢?

Thanks,

谢谢,

Stéphane.

斯特凡。

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====

2 个解决方案

#1


1  

You can change the Node.js version which Visual Studio 2015 from "Tools > Options menu and Projects and Solutions > External Web Tools tab. You should add your Node.js intallation folder (For example: C:\Program Files (x86)\nodejs). Make sure that your added folder top of older (default) Node.js folder. And lastly it needed restart of Visual Studio 2015.

您可以从“工具>选项”菜单和“项目和解决方案”>“外部Web工具”选项卡更改Visual Studio 2015的Node.js版本。您应该添加Node.js安装文件夹(例如:C:\ Program Files(x86)\ nodejs)。确保你添加的文件夹位于旧版(默认)Node.js文件夹的顶部。最后需要重启Visual Studio 2015。

For more details you can check here.

有关详细信息,请查看此处。

#2


3  

Found a great answer in the Developer Tools Blog : https://blogs.msdn.microsoft.com/webdev/2015/03/19/customize-external-web-tools-in-visual-studio-2015/

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

Since the desired node.js version was already installed globally, all I had to do was to change the order of the external tools path, so VS will search the $(PATH) first, and make it look like that:

由于所需的node.js版本已全局安装,我所要做的就是更改外部工具路径的顺序,因此VS将首先搜索$(PATH),并使其看起来像这样:

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

#1


1  

You can change the Node.js version which Visual Studio 2015 from "Tools > Options menu and Projects and Solutions > External Web Tools tab. You should add your Node.js intallation folder (For example: C:\Program Files (x86)\nodejs). Make sure that your added folder top of older (default) Node.js folder. And lastly it needed restart of Visual Studio 2015.

您可以从“工具>选项”菜单和“项目和解决方案”>“外部Web工具”选项卡更改Visual Studio 2015的Node.js版本。您应该添加Node.js安装文件夹(例如:C:\ Program Files(x86)\ nodejs)。确保你添加的文件夹位于旧版(默认)Node.js文件夹的顶部。最后需要重启Visual Studio 2015。

For more details you can check here.

有关详细信息,请查看此处。

#2


3  

Found a great answer in the Developer Tools Blog : https://blogs.msdn.microsoft.com/webdev/2015/03/19/customize-external-web-tools-in-visual-studio-2015/

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

Since the desired node.js version was already installed globally, all I had to do was to change the order of the external tools path, so VS will search the $(PATH) first, and make it look like that:

由于所需的node.js版本已全局安装,我所要做的就是更改外部工具路径的顺序,因此VS将首先搜索$(PATH),并使其看起来像这样:

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