2017-11-05 31 views
5

Sau khi nâng cấp lên góc 5 và Cli 1.5, trên ng serve Tôi nhận được một lỗi:góc 5 webpack biên soạn lỗi

ERROR in ./node_modules/@stomp/ng2-stompjs/index.ts 
    Module build failed: Error: ...\project\node_modules\@stomp\ng2-stompjs\index.ts is not part of the compilation output. Please check the other error messages for details. 
     at AngularCompilerPlugin.getCompiledFile (...\project\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23) 
     at plugin.done.then (...\project\node_modules\@ngtools\webpack\src\loader.js:467:39) 
     at <anonymous> 
     at process._tickCallback (internal/process/next_tick.js:188:7) 
    @ ./src/app/app.module.ts 27:0-63 
    @ ./src/main.ts 
    @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts 

Tôi đã cố gắng thêm include để tôi tsconfig.app.json để nó trông như thế này:

{ 
    "extends": "../tsconfig.json", 
    "compilerOptions": { 
    "outDir": "../out-tsc/app", 
    "module": "es2015", 
    "baseUrl": "", 
    "types": [] 
    }, 
    "include": [ 
    "../node_modules/@stomp/**/*.ts" 
    ], 
    "exclude": [ 
    "test.ts", 
    "**/*.spec.ts" 
    ] 
} 

tôi đã cố gắng tái chạy ng serve tôi nhận được một lỗi:

ERROR in ./src/main.ts 
Module build failed: Error: ...project\chatAngular4\src\main.ts is not part of the compilation output. Please check the other error messages for details. 
    at AngularCompilerPlugin.getCompiledFile (...project\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23) 
    at plugin.done.then (...project\node_modules\@ngtools\webpack\src\loader.js:467:39) 
    at <anonymous> 
    at process._tickCallback (internal/process/next_tick.js:188:7) 
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts 
ERROR in ./src/polyfills.ts 
Module build failed: Error: C:\Users\MEP2\Desktop\chatAngular4\src\polyfills.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. 
    at AngularCompilerPlugin.getCompiledFile (...project\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:624:23) 
    at plugin.done.then (...project\node_modules\@ngtools\webpack\src\loader.js:467:39) 
    at <anonymous> 
@ multi ./src/polyfills.ts 

Điều này có vẻ như nó cần một số loại giải pháp chung. Ý tưởng nào?


Cập nhật

Sau khi cập nhật tất cả các gói lên phiên bản mới nhất, vấn đề disapeared

+0

stomp js là để được đổ lỗi cho tôi đoán –

+0

''suppressImplicitAnyIndexErrors": true, 'thêm tệp này vào tệp tsconfig của bạn – Aravind

+2

Thay đổi Angular 5 chưa được phát hành cho NPM. Ngoài ra, nó chưa được sửa hoàn toàn. –

Trả lời

1

tôi đã nhận được báo lỗi tương tự như bạn liên quan đến main.ts và polyfills.ts không được bao gồm trong Cấu hình.

Tôi đã thêm các tệp đó vào phần "bao gồm" của tệp tsconfig.app.json và nó bắt đầu hoạt động cho tôi.

Thật lạ lùng, sau khi tôi thêm điều này vào dự án đầu tiên của mình, tôi đã tạo một dự án khác và không phải thực hiện thêm bước đó.

Đây là tsconfig.app.json tôi:

{ 
    "extends": "../tsconfig.json", 
    "compilerOptions": { 
    "outDir": "../out-tsc/app", 
    "baseUrl": "./", 
    "module": "es2015", 
    "types": [] 
    }, 
    "exclude": [ 
    "test.ts", 
    "**/*.spec.ts" 
    ], 
    "include": [ 
    "main.ts", 
    "polyfills.ts" 
    ] 
} 
+0

Bạn có thể vui lòng chia sẻ tsconfig.app.json của bạn không? – zhekaus

3

Hãy thử ng serve --preserve-symlinks.

Nó giúp trong hầu hết các trường hợp cho phiên bản hiện tại của Góc.

Hoặc cách khác đơn giản là không chạy ng serve từ thư mục được liên kết tượng trưng. Chạy nó từ thực tế.

Mong khi họ khắc phục.