Angular 没有导出的成员';MdCardModule';和';MdTooltipModule'; 当我运行ng build时,它会显示一些错误:

Angular 没有导出的成员';MdCardModule';和';MdTooltipModule'; 当我运行ng build时,它会显示一些错误:,angular,npm,frontend,angular-cli,npm-install,Angular,Npm,Frontend,Angular Cli,Npm Install,C:/761/搜索中出错- bar/workload\u management\u app/Client/src/app/app.module.ts(8,9): 模块“C:/761/搜索- 酒吧/工作量\管理\应用程序/客户端/节点\模块/@angular/material l/物料“”没有导出的成员“MdCardModule” C:/761/搜索中出错- bar/workload\u management\u app/Client/src/app/app.module.ts(8,23): 模块

C:/761/搜索中出错- bar/workload\u management\u app/Client/src/app/app.module.ts(8,9): 模块“C:/761/搜索- 酒吧/工作量\管理\应用程序/客户端/节点\模块/@angular/material l/物料“”没有导出的成员“MdCardModule”

C:/761/搜索中出错- bar/workload\u management\u app/Client/src/app/app.module.ts(8,23): 模块“C:/761/搜索- 酒吧/工作量\管理\应用程序/客户端/节点\模块/@angular/material/material“' 没有导出的成员“MDToolTimpModule”

MdCardModule中的错误不是NgModule

C:/761/搜索中出错- bar/workload\u management\u app/Client/src/app/app.module.ts(8,9):模块 'C:/761/搜索- 酒吧/工作量\管理\应用程序/客户机/节点\模块/@angular/material/material l“”没有导出的成员“MdCardModule”

C:/761/搜索中出错- bar/workload\u management\u app/Client/src/app/app.module.ts(8,23):模块 'C:/761/搜索- 酒吧/工作量\管理\应用程序/客户机/节点\模块/@angular/material/material al“”没有导出的成员“MDToolTimpModule”

package.json 我怎么解决这个问题,有人能帮我吗? PS:我以前试过运行
npm安装--save@angular/material
,但没有成功


如果使用angular cli,则必须导入要使用的每个材质组件,然后可以在app.module.ts中全局导入它们,如

import { MdCardModule, MdTooltipModule} from '@angular/material';

  imports: [MdCardModule, MdTooltipModule]

问题在于你的角度。将角度版本更新为
4.4.3
或更高版本。材料
2.0.0-beta.11
取决于
4.4.3
或更高版本。从[变更日志]/strong>][1]文档中:

中断更改 角材质现在需要角4.4.3或更高版本


原因是您使用的是
MdCardModule
,但它应该是
MatCardModule
。将所有导入模块的
Md
更改为
Mat
。这是相当令人困惑的,因为它几乎在3周前就被更改了,但甚至仍然使用不再工作的
Md
样式

从beta.11变更日志:

Deprecation of "md" prefix.

In earlier betas, we've had a compatibility mode that allowed people to use either "md" or "mat" as the selector for Angular Material components. This was created so that these components could live side-by-side with AngularJS Material without CSS from the two libraries colliding.

For beta.11, we've made the decision to deprecate the "md" prefix completely and use "mat" moving forward. This affects all class names, properties, inputs, outputs, and selectors (CSS classes were changed back in February). The "md" prefixes will be removed in the next beta release.

You can automatically update your projects with the angular-material-prefix-updater tool. Check out the tool's page for instructions on how to run.
对于beta.11,我们决定完全不使用“md”前缀,并继续使用“mat”。这会影响所有的类名、属性、输入、输出和选择器(CSS类在2月份被更改)。“md”前缀将在下一个测试版中删除


从角度材质更改日志:

Deprecation of "md" prefix.

In earlier betas, we've had a compatibility mode that allowed people to use either "md" or "mat" as the selector for Angular Material components. This was created so that these components could live side-by-side with AngularJS Material without CSS from the two libraries colliding.

For beta.11, we've made the decision to deprecate the "md" prefix completely and use "mat" moving forward. This affects all class names, properties, inputs, outputs, and selectors (CSS classes were changed back in February). The "md" prefixes will be removed in the next beta release.

You can automatically update your projects with the angular-material-prefix-updater tool. Check out the tool's page for instructions on how to run.
好消息是,从beta 11到beta 12之间有一段时间:


尝试过,效果很好。

尝试删除
node\u模块
目录和
package lock.json
并运行
npm安装
。然后再次尝试构建。谢谢,我尝试了你所说的,但仍然有相同的问题我现在有相同的问题。我想我已经从“@angular/material;”导入了它们
import{MdCardModule,MdTooltipModule,MatButtonModule}”但它显示错误:
没有导出的成员MdCardModule…
app.module.ts
从“@angular/material”导入{MdCardModule,MdTooltipModule,MatButtonModule}
导入:[BrowserModule、BrowserAnimationsModule、BusyModule、NgbModule.forRoot()、RouterModule.forRoot(批准,{enableTracing:true})、FormsModule、HttpModule、AlertModule.forRoot()、Ng2DragDropModule.forRoot()、MdCardModule、MDToolTiModule、MatButtonModule],
我试图将我的版本更新到最新的“依赖项”:“{@angular/animations”:“^4.4.4”、“@angular/cdk”:“^2.0.0-beta.11”、“@angular/common”:“^4.4.4”、“@angular/compiler”:“^4.4.4.4”、“@angular/core”:“^4.4.4.4”、“@angular/forms”:“^4.4.4.4”、“@angular/http”:,“@angular/material”:“^2.0.0-beta.11”、“@angular/platform browser”:“^4.4.4”、…},但它仍然显示相同的错误:TS2305模块…没有导出成员…在您的包中。json,将此
“@angular/material”:“github:angular/material2 builds”
更改为此:
“@angular/material”:“^2.0.0-beta.11“,
,然后重试
“依赖项”:“{@angular/animations”:“^4.4.4”、“@angular/cdk”:“^2.0.0-beta.11”、“@angular/common”:“^4.4.4”、“@angular/compiler”:“^4.4.4.4”、“@angular/core”:“^4.4.4.4”、“@angular/forms”:“^4.4.4.4.4”、“@angular/http”:“、@angular/material“^2.0.0-beta.11”,
仍然存在该问题