2017-07-13 59 views
1

問題錯誤多的WebPack-DEV-服務器/客戶端的http://本地主機:4200

  • 我跑的時候我跑
    1. NPM啓動 或
    2. 納克服務的角度CLI問題。

錯誤:webpack:無法編譯。

納克版本

@angular/cli: 1.1.0 
node: 6.11.0 
os: win32 x64 
@angular/animations: 4.2.6 
@angular/common: 4.2.6 
@angular/compiler: 4.2.6 
@angular/core: 4.2.6 
@angular/forms: 4.2.6 
@angular/http: 4.2.6 
@angular/platform-browser: 4.2.6 
@angular/platform-browser-dynamic: 4.2.6 
@angular/router: 4.2.6 
@angular/cli: 1.1.0 
@angular/compiler-cli: 4.2.6 
@angular/language-service: 4.2.6 

節點版本v6.11.0

D:\Angular2DevApp>npm version 
{ 'angular2-dev-app': '0.0.0', 
    npm: '5.2.0', 
    ares: '1.10.1-DEV', 
    http_parser: '2.7.0', 
    icu: '58.2', 
    modules: '48', 
    node: '6.11.0', 
    openssl: '1.0.2k', 
    uv: '1.11.0', 
    v8: '5.1.281.102', 
    zlib: '1.2.11' } 
  • 我已經安裝了新的應用程序一起工作。

  • 任何建議是最受歡迎的。

錯誤形象:enter image description here

  • 當我試圖NPM第二圖像開始 enter image description here

回答

0

試試這個: 在你的WebPack配置,添加以下插件和裝載機:

import {AotPlugin} from '@ngtools/webpack' 

exports = { /* ... */ 
    module: { 
    rules: [ 
     { 
     test: /\.ts$/, 
     loader: '@ngtools/webpack', 
     } 
    ] 
    }, 

    plugins: [ 
    new AotPlugin({ 
     tsConfigPath: 'path/to/tsconfig.json', 
     entryModule: 'path/to/app.module#AppModule' 
    }) 
    ] 
} 

加載程序與webpack插件一起編譯您的TypeScript。包含兩者都很重要,並且不要包含任何其他TypeScript編譯器加載器。

-1

From a GitHub issue:首先,我卸載舊版本的CLI的全球範圍內,清除緩存,然後全球的裝機新版本CLI,以下說明:

npm uninstall -g angular-cli @angular/cli 
npm cache clean 
npm install -g @angular/[email protected] 

然後我更新的應用程序。

相關問題