更新npm到@angular 2不可用

时间:2022-05-11 16:56:26

I want to upgrade from angular 2 Beta 15 to angular 2 RC1.

我想从角度2 Beta 15升级到角度2 RC1。

I am using Visual Studio 2015.

我正在使用Visual Studio 2015。

In my npm package.json inside Visual Studio I do:

在我的Visual Studio中的npm package.json中,我做了:

 "dependencies": {
    "@angular/core": "Unavailable",
}

but I get unavailable.

但是我没空。

Then I did some updates:

然后我做了一些更新:

I updated my nodejs to v6.1.0.
I updated my npm to v3.8.9.

It still shows unavailable in Visual Studio 2015.

它仍显示在Visual Studio 2015中不可用。

What can I still try to make it work?

我还能尝试做些什么呢?

UPDATE

After doing what @David Pine suggested I got this error:

做了什么@David Pine建议我得到这个错误:

====Executing command 'npm install'====


npm WARN package.json ASP.NET@0.0.0 No description
npm WARN package.json ASP.NET@0.0.0 No repository field.
npm WARN package.json ASP.NET@0.0.0 No README data
npm http GET https://registry.npmjs.org/angular/core
npm http 404 https://registry.npmjs.org/angular/core
npm ERR! 404 Not Found
npm ERR! 404 
npm ERR! 404 'angular/core' 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 'ASP.NET'
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:\TGB.2016\TGB.Web
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.9
npm ERR! code E404

====npm command completed with exit code 1====

UPDATE 2

I also added the correct path to nodejs in my Visual Studio options see:

我还在Visual Studio选项中添加了nodejs的正确路径,请参阅:

http://ryanhayes.net/synchronize-node-js-install-version-with-visual-studio-2015/

2 个解决方案

#1


4  

Ensure that Node.js is at the top of the external web tools paths in Visual Studio, detailed here.

确保Node.js位于Visual Studio中外部Web工具路径的顶部,详细信息请参见此处。

I have found that Visual Studio 2015 can be unreliable in terms of integrating with npm. Instead of relying on VS to update it for you, open up the package.json and manually enter the version you're looking for.

我发现Visual Studio 2015在与npm集成方面可能不可靠。不要依赖VS为您更新它,而是打开package.json并手动输入您正在寻找的版本。

Instead of:

"dependencies": {
    "@angular/core": "Unavailable",
}

Enter:

"dependencies": {
    "@angular/core": "2.0.0-rc.1",
}

#2


0  

Open command prompt (cmd) in your project folder and type 'npm install' or check this thread

在项目文件夹中打开命令提示符(cmd)并键入“npm install”或检查此线程

The solution in that thread worked to me.

该线程中的解决方案对我有用。

project.json is still not showing @angular module but once you save the project.json it will install all the dependencies by npm.

project.json仍然没有显示@angular模块,但是一旦保存了project.json,它将按照npm安装所有依赖项。

Follow this post:

关注这篇文章:

#1


4  

Ensure that Node.js is at the top of the external web tools paths in Visual Studio, detailed here.

确保Node.js位于Visual Studio中外部Web工具路径的顶部,详细信息请参见此处。

I have found that Visual Studio 2015 can be unreliable in terms of integrating with npm. Instead of relying on VS to update it for you, open up the package.json and manually enter the version you're looking for.

我发现Visual Studio 2015在与npm集成方面可能不可靠。不要依赖VS为您更新它,而是打开package.json并手动输入您正在寻找的版本。

Instead of:

"dependencies": {
    "@angular/core": "Unavailable",
}

Enter:

"dependencies": {
    "@angular/core": "2.0.0-rc.1",
}

#2


0  

Open command prompt (cmd) in your project folder and type 'npm install' or check this thread

在项目文件夹中打开命令提示符(cmd)并键入“npm install”或检查此线程

The solution in that thread worked to me.

该线程中的解决方案对我有用。

project.json is still not showing @angular module but once you save the project.json it will install all the dependencies by npm.

project.json仍然没有显示@angular模块,但是一旦保存了project.json,它将按照npm安装所有依赖项。

Follow this post:

关注这篇文章: