hexo-renderer-sass icon indicating copy to clipboard operation
hexo-renderer-sass copied to clipboard

not able to render scss file with hexo-3.2.2

Open ghost opened this issue 8 years ago • 16 comments

ERROR Asset render failed: app.css
TypeError: Cannot read property 'node_sass' of undefined
    at Hexo.sassRenderer (D:\code\bootstrapo.com\node_modules\.npminstall\hexo-renderer-sass\0.2.0\hexo-renderer-sass\index.js:8:22)
    at D:\code\bootstrapo.com\node_modules\.npminstall\hexo\3.2.2\hexo\lib\hexo\render.js:61:21
    at tryCatcher (D:\code\bootstrapo.com\node_modules\.npminstall\bluebird\3.4.1\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\code\bootstrapo.com\node_modules\.npminstall\bluebird\3.4.1\bluebird\js\release\promise.js:504:31)
    at Promise._settlePromise (D:\code\bootstrapo.com\node_modules\.npminstall\bluebird\3.4.1\bluebird\js\release\promise.js:561:18)
    at Promise._settlePromise0 (D:\code\bootstrapo.com\node_modules\.npminstall\bluebird\3.4.1\bluebird\js\release\promise.js:606:10)
    at Promise._settlePromises (D:\code\bootstrapo.com\node_modules\.npminstall\bluebird\3.4.1\bluebird\js\release\promise.js:685:18)
    at Async._drainQueue (D:\code\bootstrapo.com\node_modules\.npminstall\bluebird\3.4.1\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (D:\code\bootstrapo.com\node_modules\.npminstall\bluebird\3.4.1\bluebird\js\release\async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\code\bootstrapo.com\node_modules\.npminstall\bluebird\3.4.1\bluebird\js\release\async.js:17:14)
    at tryOnImmediate (timers.js:543:15)

ghost avatar Jul 09 '16 07:07 ghost

Hi callmelanmao, Have you specify a correct theme on root _config.yml?

JLHwung avatar Dec 18 '16 02:12 JLHwung

sample _config.yml

node_sass:

just add node_sass in config.yml to make sure the variable exist, you could add properties to override https://github.com/sass/node-sass config

ghost avatar Dec 19 '16 16:12 ghost

Hi callmelanmao,

The error is TypeError: Cannot read property 'node_sass' of undefined, which means that hexo.theme.config is undefined.

Could you please run

hexo generate --debug | grep Theme

and post the terminal output?

Thank you.

JLHwung avatar Dec 20 '16 00:12 JLHwung

you can add these code to your theme's config file, as i remember it's called _config.yml too

node_sass:
  outputStyle: nested
  precision: 5
  sourceComments: false

ghost avatar Dec 20 '16 01:12 ghost

Hi callmelanmao,

hexo-renderer-sass works well with my theme. I set empty node_sass config because I don't customize that.

I am wondering in what situation will TypeError: Cannot read property 'node_sass' of undefined be thrown. It might be some configuration error but I need more digging around that.

Thank you.

JLHwung avatar Dec 20 '16 01:12 JLHwung

Hi callmelanmao,

Could you test against 0.3.1 to see if this issue is reproducible? Thank you.

JLHwung avatar Mar 05 '17 02:03 JLHwung

@JLHwung
i run command : hexo generate --debug | grep Theme

Output here: /home/floatg/data/FG-Blog/myBlog/node_modules/hexo-renderer-sass/lib/renderer.js:7 module.exports = (ext) => function (data) { ^ 04:05:05.148 ERROR Plugin load failed: hexo-renderer-sass SyntaxError: Unexpected token > at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/hexo/index.js:213:21) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo-renderer-sass/index.js:4:20 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/hexo/index.js:229:12 at tryCatcher (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:510:31) at Promise._settlePromise (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:567:18) at Promise._settlePromise0 (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:612:10) at Promise._settlePromises (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:691:18) at Promise._fulfill (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:636:18) at Promise._resolveCallback (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:431:57) at Promise._settlePromiseFromHandler (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:522:17) at Promise._settlePromise (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:567:18) at Promise._settlePromise0 (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:612:10) at Promise._settlePromises (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:691:18) at Promise._fulfill (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:636:18) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/nodeback.js:42:21 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-fs/node_modules/graceful-fs/graceful-fs.js:78:16 at fs.js:268:14 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/nunjucks/node_modules/chokidar/node_modules/readdirp/node_modules/graceful-fs/graceful-fs.js:43:10 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-fs/node_modules/graceful-fs/graceful-fs.js:43:10 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/warehouse/node_modules/graceful-fs/graceful-fs.js:43:10 at /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-fs/node_modules/graceful-fs/graceful-fs.js:43:10 at Object.oncomplete (fs.js:107:15) 04:05:05.554 DEBUG Theme config loaded.

Thank you

FloatingGuy avatar Mar 14 '17 04:03 FloatingGuy

Hi Floating Guy.

I doubt the error is due to incompatible node.js versions. What's the output of the following command?

node --version

Thank you.

JLHwung avatar Mar 14 '17 04:03 JLHwung

v0.10.25

FloatingGuy avatar Mar 14 '17 04:03 FloatingGuy

Hi Floating Guy,

Unfortunately hexo-renderer-sass has dropped supports on node.js v0.10 and v0.12 as many other node.js package did.

If you are using node.js v0.12 or older, please stick to v0.2.0, thank you.

JLHwung avatar Mar 14 '17 05:03 JLHwung

Hi @JLHwung

Thanks, i have install node.js v6.9.4, still hava a bug.

myBlog git:(master) ✗ hexo generate --debug | grep Theme

/home/floatg/data/FG-Blog/myBlog/node_modules/hexo-renderer-sass/lib/renderer.js:7 module.exports = (ext) => function (data) { ^ 05:41:23.926 ERROR Plugin load failed: hexo-renderer-sass SyntaxError: Unexpected token > at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/hexo/index.js:213:21) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo-renderer-sass/index.js:4:20 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/hexo/index.js:229:12 at tryCatcher (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:510:31) at Promise._settlePromise (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:567:18) at Promise._settlePromise0 (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:612:10) at Promise._settlePromises (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:691:18) at Promise._fulfill (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:636:18) at Promise._resolveCallback (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:431:57) at Promise._settlePromiseFromHandler (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:522:17) at Promise._settlePromise (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:567:18) at Promise._settlePromise0 (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:612:10) at Promise._settlePromises (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:691:18) at Promise._fulfill (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:636:18) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/nodeback.js:42:21 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-fs/node_modules/graceful-fs/graceful-fs.js:78:16 at fs.js:268:14 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/nunjucks/node_modules/chokidar/node_modules/readdirp/node_modules/graceful-fs/graceful-fs.js:43:10 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-fs/node_modules/graceful-fs/graceful-fs.js:43:10 at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/warehouse/node_modules/graceful-fs/graceful-fs.js:43:10 at /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-fs/node_modules/graceful-fs/graceful-fs.js:43:10 at Object.oncomplete (fs.js:107:15) 05:41:24.315 DEBUG Theme config loaded. 05:41:25.653 FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html TypeError: Cannot set property 'lastIndex' of undefined at highlight (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/node_modules/highlight.js/lib/highlight.js:514:35) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/node_modules/highlight.js/lib/highlight.js:564:21 at Array.forEach (native) at Object.highlightAuto (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/node_modules/highlight.js/lib/highlight.js:563:40) at highlight (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/lib/highlight.js:100:19) at highlightUtil (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/lib/highlight.js:22:14) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/plugins/filter/before_post_render/backtick_code_block.js:49:15 at String.replace (native) at Hexo.backtickCodeBlock (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/plugins/filter/before_post_render/backtick_code_block.js:15:31) at Hexo.tryCatcher (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23) at Hexo. (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/method.js:15:34) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/extend/filter.js:68:35 at tryCatcher (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23) at Object.gotValue (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/reduce.js:155:18) at Object.gotAccum (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/reduce.js:144:25) at Object.tryCatcher (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:510:31) at Promise._settlePromise (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:567:18) at Promise._settlePromiseCtx (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:604:10) at Async._drainQueue (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/async.js:138:12) at Async._drainQueues (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/async.js:143:10) at Async.drainQueues (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/async.js:17:14) at process._tickCallback (node.js:415:13) 05:41:25.810 FATAL Cannot set property 'lastIndex' of undefined TypeError: Cannot set property 'lastIndex' of undefined at highlight (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/node_modules/highlight.js/lib/highlight.js:514:35) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/node_modules/highlight.js/lib/highlight.js:564:21 at Array.forEach (native) at Object.highlightAuto (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/node_modules/highlight.js/lib/highlight.js:563:40) at highlight (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/lib/highlight.js:100:19) at highlightUtil (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/hexo-util/lib/highlight.js:22:14) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/plugins/filter/before_post_render/backtick_code_block.js:49:15 at String.replace (native) at Hexo.backtickCodeBlock (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/plugins/filter/before_post_render/backtick_code_block.js:15:31) at Hexo.tryCatcher (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23) at Hexo. (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/method.js:15:34) at /home/floatg/data/FG-Blog/myBlog/node_modules/hexo/lib/extend/filter.js:68:35 at tryCatcher (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23) at Object.gotValue (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/reduce.js:155:18) at Object.gotAccum (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/reduce.js:144:25) at Object.tryCatcher (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:510:31) at Promise._settlePromise (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:567:18) at Promise._settlePromiseCtx (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/promise.js:604:10) at Async._drainQueue (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/async.js:138:12) at Async._drainQueues (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/async.js:143:10) at Async.drainQueues (/home/floatg/data/FG-Blog/myBlog/node_modules/hexo/node_modules/bluebird/js/release/async.js:17:14) at process._tickCallback (node.js:415:13)

FloatingGuy avatar Mar 14 '17 05:03 FloatingGuy

Hi Floating Guy,

Could you print the output of the following command?

hexo version

Thank you.

JLHwung avatar Mar 14 '17 06:03 JLHwung

hexo: 3.2.2 hexo-cli: 1.0.2 os: Linux 4.2.0-27-generic linux x64 http_parser: 2.7.0 node: 6.9.4 v8: 5.1.281.89 uv: 1.9.1 zlib: 1.2.8 ares: 1.10.1-DEV icu: 57.1 modules: 48 openssl: 1.0.2j

FloatingGuy avatar Mar 14 '17 06:03 FloatingGuy

Hi Floating Guy, I tested on node.js v6 environment and can not reproduce the issue. Could you restart your shell environment to see if this issue can be reproduced?

JLHwung avatar Mar 14 '17 13:03 JLHwung

I could only get hexo-renderer-sass to function with Node 6.x

Based on the release schedule it would be nice if this package could be updated to support Node 8.x

kmuncie avatar Dec 01 '17 03:12 kmuncie

Had the same problem, switched to https://github.com/mamboer/hexo-renderer-scss and it works fine with Node 8.x

M165437 avatar Mar 20 '18 00:03 M165437