The Broccoli Plugin: [LESSPlugin] failed with: undefined
- OS: Mac OSX (El Capitan)
- Versions: angular-cli: 1.0.0-beta.5 node: 4.3.1 os: darwin x64
- Repro steps. I have installed less css
- The log given by the failure:
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
Build failed.
File: input (1029)
The Broccoli Plugin: [LESSPlugin] failed with:
undefined
The broccoli plugin was instantiated at:
at LESSPlugin.Plugin (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)
at LESSPlugin.CachingWriter [as constructor] (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
at new LESSPlugin (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/lib/broccoli/angular-broccoli-less.js:21:12)
at Object.Plugin.build.compile.exports.makeBroccoliTree (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/lib/broccoli/angular-broccoli-less.js:52:12)
at Angular2App._buildTree (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/lib/broccoli/angular2-app.js:125:27)
at new Angular2App (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
at module.exports (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/angular-cli-build.js:6:10)
at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
at Class.module.exports.Task.extend.init (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
at new Class (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
at Class.module.exports.Task.extend.run (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19)
at /Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/lib/commands/build.js:32:24
at lib$rsvp$$internal$$tryCatch (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
at /Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
at lib$rsvp$asap$$flush (/Users/julien/Documents/projects/bignibou/bignibou-site/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
I am trying to get less css to work with my angular CLI- generated application.
I have tried and configure the plugin as follows in angular-cli-build.js
module.exports = function (defaults) {
return new Angular2App(defaults, {
vendorNpmFiles: [
'systemjs/dist/system-polyfills.js',
'systemjs/dist/system.src.js',
'zone.js/dist/**/*.+(js|js.map)',
'es6-shim/es6-shim.js',
'reflect-metadata/**/*.+(js|js.map)',
'rxjs/**/*.+(js|js.map)',
'@angular/**/*.+(js|js.map)'
],
lessCompiler: {
includePaths: [
'src/assets/styles'
]
}
});
};
Can anyone please help?
I have the same problem, didn't fixed yet... but in my case if I have @import statement insisde the .less file the error occures.
Pat
Same problem here. Any news?
Melq
@melquic Not on my side unfortunately...
Also getting this error. Seems to happen anytime a component or vendor file is added or removed. Has to do with the ng build task not running correctly
+1 - also present on Linux based systems
Same problem here. Has this just been a known issue? Has @import in LESS files worked yet on this build?
@cvharris as mentioned before, it works, if you move the imported less files out of the src/ folder and add the following to your angular-cli-build.js:
return new Angular2App(defaults, {
vendorNpmFiles: [
// ...
],
lessCompiler: {
'paths': [__dirname + '/less'] // this is the important configuration
}
});
But this really is only a workaround for the currently existing problem.
That did work, thanks for the workaround @j6s. However, this exposed what I think is at the heart of the issue: that compilation errors from less.render() are not being bubbled out by the Broccoli build. I think that would be a nice enhancement to this build, to prevent such undefined errors.
At least, that was the source of the issue in my case.
I agree. We did spend about an hour debugging to come to a conclusion that we could have reached very easily, if the messages would be bubbled out
I am having an issue importing less and css files with the (less) and (inline) keywords such as:
@import (inline) "test.css";
I've tried importing from the same directory and from the node_modules directory and I got the same error.
File: input (1)
The Broccoli Plugin: [LESSPlugin] failed with:
undefined
The broccoli plugin was instantiated at:
at LESSPlugin.Plugin (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)
at LESSPlugin.CachingWriter [as constructor] (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
at new LESSPlugin (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/lib/broccoli/angular-broccoli-less.js:21:12)
at Object.Plugin.build.compile.exports.makeBroccoliTree (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/lib/broccoli/angular-broccoli-less.js:52:12)
at Angular2App._buildTree (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/lib/broccoli/angular2-app.js:125:27)
at new Angular2App (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
at module.exports (/Users/George/Documents/Dev/ng2-kendoui/angular-cli-build.js:6:10)
at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
at Class.module.exports.Task.extend.init (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
at new Class (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
at Class.module.exports.Task.extend.run (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/serve.js:15:19)
at /Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/angular-cli/lib/commands/serve.js:64:24
at lib$rsvp$$internal$$tryCatch (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
at /Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
at lib$rsvp$asap$$flush (/Users/George/Documents/Dev/ng2-kendoui/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
any updates yet?
added "less":"^2.0.0" to devDependencies in package.json did npm install
Still having error The Broccoli Plugin: [LESSPlugin] failed with: undefined
added: return new Angular2App(defaults, { vendorNpmFiles: [ // ... ], lessCompiler: { 'paths': [__dirname + '/less'] // this is the important configuration } });
no luck
any update??
Hey,
I had this same issue, it turns out that the stacktrace is because one of the less files is referencing to a variable from a file that is not being imported by the file itself, on less you could have one file that do many imports so that you can split your css on different files. I think we could have the Angular2App to tell the lessCompiler plugin to exclude a set of files from inside our src/app dir. This change is adding that capability to the lessCompiler plugin, what do you think?
Hi,
I had same. Pls help me use lessCompliler option !
Is this error only because LESS compile errors aren't being bubbled out to the Broccoli stacktrace? Maybe thats the real issue here and we should seek an enhancement to expose it for swifter troubleshooting On Wed, Jul 6, 2016 at 05:44 Minh Nguyen [email protected] wrote:
Hi,
I had same. Pls help me use lessCompliler option !
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/873#issuecomment-230738941, or mute the thread https://github.com/notifications/unsubscribe/AD0_QOVFYLq-cQgPZUWpf9GDRBp1ij0Rks5qS4btgaJpZM4IjkkS .
Right part of the issue is that the Stacktrace is not that helpful, but also the fact that some less files should not be compiled alone, they are only useful if they get imported from another file. The approach I was following was to set a less compiler property to disable the compile a certain path inside src/app, although if I follow this and modify these files brocoli does not detect a change in this excluded path. I see two issues.
- Expose a Less compiler on the console so you can get to know why the less files did not compile, as troubleshooting.
- Allow you to have a set excluded directories with less files inside the src dir that will not get compiled.
Hi,
I have closed the previous pull request and generated another one, this one will let you exclude files but at the same time, will let broccoli watch for changes inside this exclusion and trigger a build if any less file changes under the src directory. change. Although, It will also nice to have a way to dump a nice message when the less compiler throws an exception.
I am still struggling with this issue. The lack of explicitness of the error message is really making things difficult. What is the way of determining what's the real error message?
I tried to refer the entry point less file as follows:
lessCompiler: { 'paths': [__dirname + '/src/assets/styles/bootstrap.less'] }
Which gives me the same cryptic error message:
Build failed.
File: input (1029)
The Broccoli Plugin: [LESSPlugin] failed with:
undefined
The broccoli plugin was instantiated at:
at LESSPlugin.Plugin (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/broccoli-plugin/index.js:10:31)
at LESSPlugin.CachingWriter [as constructor] (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
at new LESSPlugin (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/lib/broccoli/angular-broccoli-less.js:21:12)
at Object.Plugin.build.compile.exports.makeBroccoliTree (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/lib/broccoli/angular-broccoli-less.js:52:12)
at Angular2App._buildTree (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/lib/broccoli/angular2-app.js:133:27)
at new Angular2App (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
at module.exports (/Users/julien/Documents/projects/bignibou/bignibou-client/angular-cli-build.js:10:10)
at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
at Class.module.exports.Task.extend.init (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
at new Class (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
at Class.module.exports.Task.extend.run (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19)
at /Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/angular-cli/lib/commands/build.js:32:24
at lib$rsvp$$internal$$tryCatch (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
at /Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
at lib$rsvp$asap$$flush (/Users/julien/Documents/projects/bignibou/bignibou-client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
Can anyone please tell me how to figure out what the real error message is?
For your information, I use the following versions:
angular-cli: 1.0.0-beta.9
node: 4.4.5
os: darwin x64
P.S. Using the lessc compiler like so lessc src/assets/styles/bootstrap.less hello.css properly generates a hello.css file.
I had the same error, I think this is only because LESS compiler errors aren't recovered by the Broccoli stacktrace. I had errors when using import statements so i guessed it was a path problem. So you have to defined the src folder in the lessCompiler property of your angular-cli-build.js file.
{
...
lessCompiler: {
'paths': [ __dirname + '/src' ]
},
...
}
And then you have to make all your imports from this path :
@import "/path/to/my-file.less";
As LESS errors aren't recovered by the Broccoli stacktrace you don't know what is the problem, so maybe it's not the solution to your problem... but it worked for me.
Thanks for your message. Can you please tell me where your import:
import "/path/to/my-file.less";
is located? I am not sure where that is (within index.html for instance). I use SystemJS.
Thanks in advance.