angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.77k stars 11.98k forks source link

Cannot read property 'exclude' of undefined at applyDefaults #5911

Closed saurabhschauhan closed 7 years ago

saurabhschauhan commented 7 years ago

screenshot from 2017-04-10 16-59-27

Bug Report or Feature Request (mark with an x)

ERROR in ./src/main.ts
Module build failed: TypeError: Cannot read property 'exclude' of undefined
    at applyDefaults (/home/daffodil-201/Desktop/backup/beverage-ecommerce-maintenance/node_modules/awesome-typescript-loader/src/instance.ts:266:72)
    at Object.ensureInstance (/home/daffodil-201/Desktop/backup/beverage-ecommerce-maintenance/node_modules/awesome-typescript-loader/src/instance.ts:145:5)
    at compiler (/home/daffodil-201/Desktop/backup/beverage-ecommerce-maintenance/node_modules/awesome-typescript-loader/src/index.ts:37:20)
    at Object.loader (/home/daffodil-201/Desktop/backup/beverage-ecommerce-maintenance/node_modules/awesome-typescript-loader/src/index.ts:18:18)
 @ multi main

Issue

Hello, I'm using angular cli and I updated my app to angular4 using "npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@latest typescript@latest --save " **

Versions.

Angular version: 2.0.X Browser:Chrome Language:TypeScript Node (for AoT issues): node --version = 6.10.1

Repro steps.

when I run my app after updation I'm getting the following problem. I run my app using npm start and ng serve both.

The log given by the failure.

Module build failed: TypeError: Cannot read property 'exclude' of undefined

Desired functionality.

simply it have to compile but error occur during compilation.

Mention any other details that might be useful.

newnewb commented 7 years ago

Experiencing the same issue on windows.

Trying to update to Angular 4.

It was compiling fine on angular2 until I added

npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest typescript@latest --save

Exact same error

ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'exclude' of undefined at applyDefaults (C:\Users\user\Documents\test\final\node_modules\awesome-typescript-loader\src\instance.ts:266:72) at Object.ensureInstance (C:\Users\user\Documents\test\final\node_modules\awesome-typescript-loader\src\instance.ts:145:5) at compiler (C:\Users\user\Documents\test\final\node_modules\awesome-typescript-loader\src\index.ts:37:20) at Object.loader (C:\Users\user\Documents\test\final\node_modules\awesome-typescript-loader\src\index.ts:18:18) @ multi main

saurabhschauhan commented 7 years ago

Hi newnewb, Few days ago I was facing the issue but when I downgrade my project from angular 4.0.1 to 4.0.0 now my app is working properly. delete your node module and downgrade the angular dependency in 4.0.0 same as image and then run npm install.. hope it will work for you... screenshot from 2017-04-17 09-49-34

newnewb commented 7 years ago

Hi @saurabhschauhan ,

I think as I read it was a typescript issue, anything below 2.1.x will lead to that error,

deleted my node modules, and updated the typescript version and angular version in my packages

"@angular/common": "^4.0.2",
"@angular/compiler": "^4.0.2",
"@angular/compiler-cli": "^4.0.2",
"@angular/core": "^4.0.2",
"@angular/forms": "^4.0.2",
"@angular/http": "^4.0.2",
"@angular/platform-browser": "^4.0.2",
"@angular/platform-browser-dynamic": "^4.0.2",
"@angular/platform-server": "^4.0.2",
"@angular/router": "^4.0.2",

"typescript": "^2.2.2",

this solved the issue for me

filipesilva commented 7 years ago

Heya, I don't think the issue you are experiencing is related to Angular CLI. I see references to awesome-typescript-loader in your error logs, you should open an issue in that repo instead.

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.