Repository navigation
The Broccoli Plugin: [LESSPlugin] failed with: undefined #873
Copy link
Copy link
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgenttype: bug/fix
Description
- 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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgenttype: bug/fix
Activity
patrykbialek commentedon May 23, 2016
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
melquic commentedon May 28, 2016
Same problem here. Any news?
Melq
balteo commentedon May 28, 2016
@melquic Not on my side unfortunately...
watzon commentedon May 28, 2016
Also getting this error. Seems to happen anytime a component or vendor file is added or removed. Has to do with the
ng buildtask not running correctlyj6s commentedon May 29, 2016
+1 - also present on Linux based systems
cvharris commentedon May 29, 2016
Same problem here. Has this just been a known issue? Has
@importin LESS files worked yet on this build?j6s commentedon May 29, 2016
@cvharris as mentioned before, it works, if you move the imported less files out of the
src/folder and add the following to yourangular-cli-build.js:But this really is only a workaround for the currently existing problem.
cvharris commentedon May 31, 2016
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 suchundefinederrors.At least, that was the source of the issue in my case.
j6s commentedon Jun 1, 2016
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
gsaadeh commentedon Jun 3, 2016
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.
stevefarwell commentedon Jun 20, 2016
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
ohanspace commentedon Jun 22, 2016
any update??
5 remaining items
balteo commentedon Jul 13, 2016
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:
Can anyone please tell me how to figure out what the real error message is?
For your information, I use the following versions:
P.S. Using the lessc compiler like so
lessc src/assets/styles/bootstrap.less hello.cssproperly generates ahello.cssfile.Dammmien commentedon Jul 19, 2016
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.
And then you have to make all your imports from this path :
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.
balteo commentedon Jul 19, 2016
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.
Dammmien commentedon Jul 20, 2016
The import statement is located in a LESS file to import another LESS file as mentionned in the LESS documentation : import directive feature.
The path of the import is relative to the path declared in the lessCompiler option.
balteo commentedon Jul 20, 2016
I see. But how do you refer to the main bootstrap.less file from within your index.html?
Dammmien commentedon Jul 20, 2016
Your boostrap.less file will be compiled into a boostrap.css file in the dist folder of your project. You have just to follow the path from your index.html file to your boostrap.css file like you do to import a classic stylesheet in an html file.
balteo commentedon Jul 20, 2016
What you said abvove about the exception being hidden is interesting. Do you or someone else know of any way of having more insight into the underlying exception? I find it impossible to advance blindly. There must be a way of accessing the underlying exception through some debugging...
db6edr commentedon Jul 21, 2016
I know this is not a proper solution to get less' error message - it is rather a quick and dirty hack dumping the entire error object from less to console:
Edit node_modules/angular-cli/lib/broccoli/angular-broccoli-less.js and make the function compile(...) look like this:
In my case, it revealed that one of the input files contained invalid CSS / less code.
zgosalvez commentedon Jul 23, 2016
For anyone else trying to use Bootstrap less files to compile, here's how I got it to work. Caveat is that this approach is hard-coded in the dependency. Thanks to @db6edr for pointing out how to display error messages. The error message I got was that Less was trying to compile my Less partials. This workaround forces angular-cli to only compile
bootstrap.less.lessdirectory into/src/css/lessAdd
lessCompilerflag inangular-cli-build.jsModify
build()inangular-broccoli-less.jslike soThis is inspired by #1150 fix(sass): don't compile partials pull request.
balteo commentedon Jul 23, 2016
Using db6edr's modification of the compile function, I managed to get more insight into the error/stacktrace.
Here is the error message:
My IDE does warns me of this with the following message:
Now what puzzles me is that the following manual compilation using the this command line passes without problem:
lessc src/assets/styles/bootstrap.less dist/assets/styles/style.cssWhat could cause this inconsistency between lessc and broccoli?
balteo commentedon Jul 23, 2016
I think I am getting why my use of broccoli-less fails. I need just one less file to be compiled and not all less files within the directory mentioned by
path.If I change the
makeBroccoliTreewithin angular-broccoli-less.js fromto this:
Then a
bootstrap.cssfile is generated properly.Now I can't obviously fiddle with the
node_modulessources. How can I configure this properly?filipesilva commentedon Jul 27, 2016
Closed as this issue was made obsolete by #1455.
angular-automatic-lock-bot commentedon Sep 5, 2019
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.