2017-07-12 42 views
0

我遇到的那一刻,其中一個問題,當我包括我的應用「BrowserAnimationsModule」模塊時,我得到了以下錯誤:錯誤與動畫模塊升級到Angular4

(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 @ [email protected]?main=browser:365 
Zone.run @ [email protected]?main=browser:125 
(anonymous) @ [email protected]?main=browser:760 
ZoneDelegate.invokeTask @ [email protected]?main=browser:398 
Zone.runTask @ [email protected]?main=browser:165 
drainMicroTaskQueue @ [email protected]?main=browser:593 
ZoneTask.invoke @ [email protected]?main=browser:464 

我一直在試圖找出這一點,但我不能爲我的生活看到這裏出了什麼問題。

我加入這三條線我SystemJS配置文件下the'map」屬性:

'@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

您是否嘗試過重新安裝/重新啓動應用程序安裝所需的NPM包? – TheUnreal

+0

是的我已經嘗試重新安裝NPM軟件包並重新啓動應用程序。似乎沒有區別: – devoncrazylegs

+0

也有同樣的問題,我的npm包全部更新。 – tjvg1991

回答

0

我有同樣的問題,並遵循了這一過程,它的工作對我來說:

  1. 創建採用了棱角分明CLI一個新的項目作爲

    npm install -g @angular/cli 
    ng new PROJECT-NAME 
    cd PROJECT-NAME 
    ng serve 
    
  2. 借「依賴性」來自Angular CLI創建的項目的package.json並將其替換爲您的項目的package.json
  3. 使用此命令

    npm install --save 
    
+0

即使導入BrowserAnimationsModule後也會返回錯誤 – tjvg1991