我遇到一个问题,当我在我的应用程序中包含'BrowserAnimationsModule'模块时,我收到以下错误:
(index):26 Error: (SystemJS) Cannot read property 'prototype' of undefined
TypeError: Cannot read property 'prototype' of undefined
at __extends (http://degould-login.dev/node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js:15:68)
at eval (http://degould-login.dev/node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js:328:5)
at Object.eval (http://degould-login.dev/node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js:337:2)
at Object.eval (http://degould-login.dev/app/app.module.js:36:20)
at eval (http://degould-login.dev/app/app.module.js:82:4)
at eval (http://degould-login.dev/app/app.module.js:83:3)
at eval (<anonymous>)
Evaluating http://degould-login.dev/app/app.module.js
Evaluating http://degould-login.dev/app/main.js
Error loading http://degould-login.dev/app/main.js
at __extends (http://degould-login.dev/node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js:15:68)
at eval (http://degould-login.dev/node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js:328:5)
at Object.eval (http://degould-login.dev/node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js:337:2)
at Object.eval (http://degould-login.dev/app/app.module.js:36:20)
at eval (http://degould-login.dev/app/app.module.js:82:4)
at eval (http://degould-login.dev/app/app.module.js:83:3)
at eval (<anonymous>)
Evaluating http://degould-login.dev/app/app.module.js
Evaluating http://degould-login.dev/app/main.js
Error loading http://degould-login.dev/app/main.js
(anonymous) @ (index):26
ZoneDelegate.invoke @ zone.js@0.8.4?main=browser:365
Zone.run @ zone.js@0.8.4?main=browser:125
(anonymous) @ zone.js@0.8.4?main=browser:760
ZoneDelegate.invokeTask @ zone.js@0.8.4?main=browser:398
Zone.runTask @ zone.js@0.8.4?main=browser:165
drainMicroTaskQueue @ zone.js@0.8.4?main=browser:593
ZoneTask.invoke @ zone.js@0.8.4?main=browser:464
我一直试图解决这个问题,但我不能为我的生活看到这里出了什么问题。
我将这三行添加到'map'属性下的SystemJS配置文件中:
'@angular/animations': 'node_modules/@angular/animations/bundles/animations.umd.min.js',
'@angular/animations/browser':'node_modules/@angular/animations/bundles/animations-browser.umd.js',
'@angular/platform-browser/animations': 'node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
我已将模块包含在我的NgModule对象中:
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
//Instantiate the Angular Object
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
在页面加载之前会抛出错误。
任何人都可以提供有关此处发生的事情的任何见解吗?
由于
答案 0 :(得分:0)
我遇到了同样的问题,并遵循了这个过程,它对我有用:
使用Angular CLI创建一个新项目
npm install -g @angular/cli
ng new PROJECT-NAME
cd PROJECT-NAME
ng serve
使用此命令安装所需的npm包
npm install --save