Angular-cli: Cannot read property 'sourceDir' of undefined

Created on 4 May 2016  路  7Comments  路  Source: angular/angular-cli

I am filing a bug.

  1. OS. Mac OSX El Capitan.
  2. Versions:
angular-cli: 0.0.37
node: 5.1.0
os: darwin x64
  1. Repro steps:
    Just run ng serve
  2. Error logs:
 Cannot read property 'sourceDir' of undefined
TypeError: Cannot read property 'sourceDir' of undefined
    at new Angular2App (/Users/ruwhan/Projects/dfci/test-portal/node_modules/angular-cli/lib/broccoli/angular2-app.js:30:40)
    at module.exports (/Users/ruwhan/Projects/dfci/test-portal/angular-cli-build.js:6:10)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/ruwhan/Projects/dfci/test-portal/node_modules/angular-cli/lib/models/builder.js:55:19)
    at Class.module.exports.Task.extend.init (/Users/ruwhan/Projects/dfci/test-portal/node_modules/angular-cli/lib/models/builder.js:89:10)
    at new Class (/Users/ruwhan/Projects/dfci/test-portal/node_modules/core-object/core-object.js:18:12)
    at Class.module.exports.Task.extend.run (/Users/ruwhan/Projects/dfci/test-portal/node_modules/angular-cli/lib/tasks/serve.js:15:19)
    at /Users/ruwhan/Projects/dfci/test-portal/node_modules/angular-cli/lib/commands/serve.js:64:24
    at lib$rsvp$$internal$$tryCatch (/Users/ruwhan/Projects/dfci/test-portal/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/ruwhan/Projects/dfci/test-portal/node_modules/rsvp/dist/rsvp.js:1048:17)
    at /Users/ruwhan/Projects/dfci/test-portal/node_modules/rsvp/dist/rsvp.js:331:11
    at lib$rsvp$asap$$flush (/Users/ruwhan/Projects/dfci/test-portal/node_modules/rsvp/dist/rsvp.js:1198:9)
    at doNTCallback0 (node.js:430:9)
    at process._tickCallback (node.js:359:13)

Most helpful comment

@AhmedAlgonsel change angular-cli.json to be like:
{
"routes": [],
"defaults": {
"sourceDir": "src/client"
}
}

Kind regards

All 7 comments

I ran into this earlier today
https://github.com/angular/angular-cli/issues/616
Found the fixes for it.

Your angular-cli-build.js should pass an object as option to Angular2App. That object can be empty, but normally should include a vendorNpmFiles because we don't provide one for you anymore.

I'll leave this open as an issue that if no options object is passed in we should at least fail properly.

I have the same issue also
I use win 10
64bit

@AhmedAlgonsel change angular-cli.json to be like:
{
"routes": [],
"defaults": {
"sourceDir": "src/client"
}
}

Kind regards

i am facing same problem did all what is mentioned above but not resolved.

I've create the file angular-cli.json to be like:
{
"routes": [],
"defaults": {
"sourceDir": "src"
}
}

And after that, I was able to run "ng serve", but this is not a fix. It is a workaround!
The issue is still present in [email protected], I suggest to re-open this issue until we fix the underling issue.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brtnshrdr picture brtnshrdr  路  3Comments

sysmat picture sysmat  路  3Comments

ericel picture ericel  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

purushottamjha picture purushottamjha  路  3Comments