依赖包安装后,执行ng serve 后报错,找不到 @angular/animations 模块
我猜应该是因为 animations 从Angular 最新版本的core模块中移除了,代码需要根据具体的Angular 版本改动吧,比如import导入模块语句。
完整的信息,包括ng版本信息,主要是报错信息:
执行 ng -v
@angular/cli: 1.0.1
node: 6.9.4
os: win32 x64
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/flex-layout: 2.0.0-beta.8
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/material: 2.0.0-beta.3
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10
@angular/cli: 1.0.1
@angular/compiler-cli: 2.4.10
执行 ng serve
** NG Live Development Server is running on http://localhost:4200 **
Hash: dfda5f6efe13451ae887
Time: 33757ms
chunk {0} main.bundle.js, main.bundle.js.map (main) 68.4 kB {2} [initial] [rendered]
chunk {1} styles.bundle.js, styles.bundle.js.map (styles) 67 kB {3} [initial] [rendered]
chunk {2} vendor.bundle.js, vendor.bundle.js.map (vendor) 4.89 MB [initial] [rendered]
chunk {3} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/media-query/breakpoints/break-points-token.js
13:29-43 "export 'InjectionToken' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/flex.js
299:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/layout.js
177:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/show-hide.js
296:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/flex-align.js
177:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/flex-fill.js
53:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/flex-offset.js
163:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/flex-order.js
161:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/layout-align.js
256:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/layout-wrap.js
204:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/layout-gap.js
243:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/class.js
287:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/.2.0.0-beta.8@@angular/flex-layout/flexbox/api/style.js
333:12-21 "export 'Renderer2' was not found in '@angular/core'
ERROR in F:/test/ng2-tut/node_modules/@angular/material/typings/dialog/dialog-container.d.ts (2,32): Cannot find module '@angular/animations'.
ERROR in F:/test/ng2-tut/node_modules/@angular/material/typings/menu/menu-animations.d.ts (1,42): Cannot find module '@angular/animations'.
ERROR in F:/test/ng2-tut/node_modules/@angular/material/typings/select/select-animations.d.ts (1,42): Cannot find module '@angular/animations'.
ERROR in F:/test/ng2-tut/node_modules/@angular/material/typings/snack-bar/snack-bar-container.d.ts (2,32): Cannot find module '@angular/animations'.
ERROR in F:/test/ng2-tut/node_modules/@angular/material/typings/tabs/tab-body.d.ts (2,32): Cannot find module '@angular/animations'.
ERROR in F:/test/ng2-tut/node_modules/@angular/material/typings/tooltip/tooltip.d.ts (2,32): Cannot find module '@angular/animations'.
ERROR in F:/test/ng2-tut/node_modules/@angular/flex-layout/flexbox/api/base.d.ts (8,22): Module '"F:/test/ng2-tut/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
ERROR in F:/test/ng2-tut/node_modules/@angular/flex-layout/flexbox/api/base-adapter.d.ts (8,22): Module '"F:/test/ng2-tut/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
ERROR in F:/test/ng2-tut/node_modules/@angular/flex-layout/media-query/breakpoints/break-points-provider.d.ts (8,10): Module '"F:/test/ng2-tut/node_modules/@angular/core/index"' has no exported member 'InjectionToken'.
ERROR in F:/test/ng2-tut/node_modules/@angular/flex-layout/media-query/breakpoints/break-points-token.d.ts (8,10): Module '"F:/test/ng2-tut/node_modules/@angular/core/index"' has no exported member 'InjectionToken'.
ERROR in Error encountered resolving symbol values statically. Calling function 'InjectionToken', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol BREAKPOINTS in F:/test/ng2-tut/node_modules/@angular/flex-layout/media-query/breakpoints/break-points-token.d.ts, resolving symbol DEFAULT_BREAKPOINTS_PROVIDER in F:/test/ng2-tut/node_modules/@angular/flex-layout/media-query/breakpoints/break-points-provider.d.ts, resolving symbol FlexLayoutModule in F:/test/ng2-tut/node_modules/@angular/flex-layout/flexbox/_module.d.ts, resolving symbol FlexLayoutModule in F:/test/ng2-tut/node_modules/@angular/flex-layout/flexbox/_module.d.ts
ERROR in .//.2.0.0-beta.3@@angular/material/@angular/material.es5.js
Module not found: Error: Can't resolve '@angular/animations' in 'F:\test\ng2-tut\node_modules.2.0.0-beta.3@@angular\material@angular'
@ .//.2.0.0-beta.3@@angular/material/@angular/material.es5.js 20:0-81
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
ERROR in .//.0.27.3@css-loader?{"sourceMap":false,"importLoaders":1}!.//.1.3.3@postcss-loader?{"ident":"postcss"}!.//.6.0.3@sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module build failed:
@import '@angular/material/core/theming/all-theme';
^
File to import not found or unreadable: ~@angular/material/core/theming/all-theme.
Parent style sheet: stdin
in F:\test\ng2-tut\src\styles.scss (line 1, column 1)
@ ./src/styles.scss 4:14-211
@ multi ./src/styles.css ./src/styles.scss
webpack: Failed to compile.