hexo-renderer-sass
hexo-renderer-sass copied to clipboard
not able to render scss file with hexo-3.2.2
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)
Hi callmelanmao,
Have you specify a correct theme
on root _config.yml
?
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
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.
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
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.
Hi callmelanmao,
Could you test against 0.3.1 to see if this issue is reproducible? Thank you.
@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
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.
v0.10.25
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.
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.
Hi Floating Guy,
Could you print the output of the following command?
hexo version
Thank you.
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
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?
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
Had the same problem, switched to https://github.com/mamboer/hexo-renderer-scss and it works fine with Node 8.x