2016-09-06 54 views
0

我更新爲RC6(來自RC5)並使用angular quickstart中的示例systemjs.config.js我收到錯誤(SystemJS)SyntaxError:意外的令牌。我使用了快速啓動示例配置,併爲我的應用使用的軟件包添加了更多地圖項目(下面列出)。除此之外,它與示例中的配置相同。更新到Angular2 RC6後SystemJs錯誤

 'ng2-bootstrap': 'npm:ng2-bootstrap/ng2-bootstrap.js', 
     'moment': 'npm:moment/moment.js', 
     'primeng': 'npm:primeng/primeng.js', 
     'angular2-jwt': 'node_modules/angular2-jwt/angular2-jwt.js', 
     'lodash': 'npm:lodash/lodash.js' 
+0

意外的標記通常是語法錯誤 - 缺少或多餘的引號,缺少逗號或類似的東西。對我來說,它通常是一個缺失的逗號或一個附加的分號,因爲在編寫對象定義時,我總是忘記添加一個(逗號)或不添加另一個(分號)。 –

+0

@ Steven-Luke,我下載了[angular quickstart](https://github.com/angular/quickstart/tree/3b7452cc444c49c139ea39523ced0468c2362c16),並添加了我在我的應用中使用的附加包(上面列出),並將它們添加到了systemjs .config.js(如上所述),然後啓動應用程序,它運行沒有問題。在我的應用程序中,我沒有更改我的代碼,我只更新到RC6並更新了systemjs配置。我也嘗試刪除節點模塊中的所有內容並重新安裝所有軟件包,但仍然沒有運氣。 – HisDivineShadow

+0

我已經快速入門,並將我的應用程序代碼移入該項目,並且正在取得進展(即使從我的VS2015項目運行的應用程序仍然有相同的錯誤)。在應用程序的快速入門版本中,我現在得到如下錯誤:GET http:// localhost:3000/node_modules/ng2-bootstrap/ng2-bootstrap.js/ng2-bootstrap 404(Not Found) 不知道爲什麼它會把url上的extra/ng2-bootstrap,否則路徑是正確的。 – HisDivineShadow

回答

0

經過一番修改後,我做了以下修改來解決問題。

在原來的問題的映射條目改爲此

'moment': 'npm:moment/moment.js', 
    'angular2-jwt': 'npm:angular2-jwt/angular2-jwt.js', 
    'ng2-bootstrap': 'npm:ng2-bootstrap', 
    'primeng': 'npm:primeng', 
    'lodash': 'npm:lodash' 

然後我說這些包定義

primeng: { defaultExtension: 'js' }, 
    'ng2-bootstrap': { 
     main: 'ng2-bootstrap.js', 
     defaultExtension: 'js' 
    }, 
    lodash: { 
     main: 'index.js', 
     defaultExtension: 'js' 
    } 

錯誤消息扔我(以及缺乏瞭解什麼systemJS配置中的設置實際上是在做)。

相關問題