Fatal error: Cannot read property 'canonicalDir' of undefined
saadfarooq opened this issue · 2 comments
From what I can tell, this error occurs when a component appears as a dependency of a direct project dependency (i.e. project depends on 'A' and 'A' depends on 'B' but project does not depend on 'B' directly) and a mainFile
is declared via the plugin config. In this case lists.map.dependencies[name]
does not return the proper object since it's looking at top-level (direct) dependencies only. This results in findMainFiles
failing when it tries to read the meta.canonicalDir
property.
A workaround is to include the dependency for which this issue occurs explicitly in your bower.json
so it becomes a top level dependency but eventually the plugin should handle this condition.
Could you provide and example? Gruntfile + bower.json.
The following should get you the error in any Grunt based project that uses bower_concat
(I assume you have a bunch).
bower install --save angular-ui-ace\#bower
Once you add that and run, you should get:
Fatal error: Can’t detect main file for "ace-builds" component. You should explicitly define it via bower_concat’s mainFiles option. See Readme for details.
ace-builds
is a dependency of angular-ui-ace
. You can then add this in your bower_concat
block to define a mainFile
for ace-builds
bower_concat: {
all: {
dest: 'build/_bower.js',
mainFiles: {
'ace-builds': 'src/ace.js'
}
}
}
Once you have that, it gives:
Fatal error: Cannot read property 'canonicalDir' of undefined
That should be pretty quick. If that doesn't go well for you, I'll add the project files.