Broken on node v6.0.0
Running
lessc main.less build.css
won't output any error and no build file.
Running with nodemon yields more info:
› nodemon -e less --exec 'lessc src/main.less build.css'
(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.
==== JS stack trace =========================================
Security context: 0x36610d2c9fa9 <JS Object>#0#
1: .node [module.js:568] [pc=0x1aa0081d0f64] (this=0x225da61d89b9 <an Object with map 0x7af7e117be1>#1#,module=0x2666c00042f1 <a Module with map 0x7af7e1181b9>#2#,filename=0x2666c0004251 <String[136]: /Users/zigomir/.nvm/versions/node/v6.0.0/lib/node_modules/nodemon/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node>)
2: load [module.js:456] [pc=0x1aa008138e72] (this=0x2666c00042f1 <a Module with map 0x7af7e1181b9>#2#,filename=0x2666c0004251 <String[136]: /Users/zigomir/.nvm/versions/node/v6.0.0/lib/node_modules/nodemon/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node>)
3: tryModuleLoad(aka tryModuleLoad) [module.js:415] [pc=0x1aa00813899d] (this=0x36610d204189 <undefined>,module=0x2666c00042f1 <a Module with map 0x7af7e1181b9>#2#,filename=0x2666c0004251 <String[136]: /Users/zigomir/.nvm/versions/node/v6.0.0/lib/node_modules/nodemon/node_mo 1: v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)
2: fse::FSEvents::Initialize(v8::Local<v8::Object>)
3: node::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)
4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&))
5: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>)
6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
7: 0x1aa00800961b
8: 0x1aa0081d0f64
(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.
==== JS stack trace =========================================
Security context: 0x36610d2c9fa9 <JS Object>#0#
1: .node [module.js:568] [pc=0x1aa0081d0f64] (this=0x225da61d89b9 <an Object with map 0x7af7e117be1>#1#,module=0x2666c00042f1 <a Module with map 0x7af7e1181b9>#2#,filename=0x2666c0004251 <String[136]: /Users/zigomir/.nvm/versions/node/v6.0.0/lib/node_modules/nodemon/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node>)
2: load [module.js:456] [pc=0x1aa008138e72] (this=0x2666c00042f1 <a Module with map 0x7af7e1181b9>#2#,filename=0x2666c0004251 <String[136]: /Users/zigomir/.nvm/versions/node/v6.0.0/lib/node_modules/nodemon/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node>)
3: tryModuleLoad(aka tryModuleLoad) [module.js:415] [pc=0x1aa00813899d] (this=0x36610d204189 <undefined>,module=0x2666c00042f1 <a Module with map 0x7af7e1181b9>#2#,filename=0x2666c0004251 <String[136]: /Users/zigomir/.nvm/versions/node/v6.0.0/lib/node_modules/nodemon/node_mo 1: v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)
2: fse::FSEvents::Initialize(v8::Local<v8::Object>)
3: node::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)
4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&))
5: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>)
6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
7: 0x1aa00800961b
8: 0x1aa0081d0f64
Less itself does not use any ObjectTemplate.Set function, so it's probably one of its dependencies. There's long chain of dependency updates in the current master so it's hard to tell yet how difficult it may be to get v6-compatible release. Feel free to investigate it yourself deeper and suggest a patch/PR.
That looks like an issue with nodemon, not less
Seeing the same. Running lessc on any trivial .less file ouputs no build file and no errors under Node.js v6, even in verbose mode.
I've found the cause:
The current published version of Less calls path.dirname() with undefined which throws an error with node v6. This has already been addressed by ec04a03f1cba3a092d5cd7f7c5d8e28bb43c1932 but not published yet. The error is not thrown because the current implementation of lessc swallows all errors caused by Less itself. I've created a PR to fix this.
So, emm, which one to merge? #2882 or #2884? :)
They fix two different issues IMO
So both? (I'm asking because they somewhat overlap and merging both would need some additional editing).
the other one uses process.exit() directly, which should be avoided to prevent not flushing stdout/stderr
@evanlucas Can you describe how this problem with calling process.exit() directly can be reproduced? I definitely agree with you that process.exit() should be used in rare cases because usually it's better to terminate it regularly or by throwing an error. In this case, however, I think process.exit() with an error code is more appropriate, because we don't want to show a stack trace for expected errors. And it also seems weird to me to continue execution but prevent further processing with a flag (like it is currently implemented).
setting process.exitCode does not show a stack trace. process.exit() does not actually flush process.stdout or process.stderr (and they are both non-blocking). You should only have to explicitly call it in rare cases. Otherwise, close all of your handles and the event loop will close on it's own, which will cause the process to exit.
Related: https://github.com/nodejs/node/issues/6409
Thx for clarifying this. I did not know that process.exit() is non-blocking. I'm going to update my PR asap.
One thing though: If process.exit() did not flush process.stdout – why is there an output in my console? :grin:
It is possible to have already flushed by the time the stream is closed. It just isn't a guarantee. That is why there is sometimes (partial) output in the console.
Confirmed that, at least for us, running in head (which includes https://github.com/less/less.js/commit/ec04a03f1cba3a092d5cd7f7c5d8e28bb43c1932 ), this gets resolved.
Using "--source-map" still generates an empty css file for me.. (otherwise working for me). node.js v6.0.0 on windows 8 64-bit.
@ewebdev yep, I can confirm this. With #2891, it throws:
lessc --source-map-map-inline styles/main.less
path.js:7
throw new TypeError('Path must be a string. Received ' + inspect(path));
^
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.basename (path.js:1355:5)
at /Users/jhnns/dev/jhnns/less.js/bin/lessc:292:61
at Object.<anonymous> (/Users/jhnns/dev/jhnns/less.js/bin/lessc:486:3)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Function.Module.runMain (module.js:575:10)
I would be ok to open a PR that fixes this, but I'm not sure what source map options are supported in which situations, e.g. when the output is process.stdout. This code is a bit complicated and probably requires some refactoring...
Confirm, this breaks with node 6. No error is output :(
Are we still waiting on a PR to fix this?
AFAICT, this is fixed on head, so waiting for a npm package publish..
(Others should confirm.)