I am getting this error on run of my stylus
using connect server. I am not getting final out put as .css
file here.
error:
D:\Projects\TCP\node_modules\stylus\lib\renderer.js:187
this.options.paths.push(path);
^
TypeError: Cannot read property 'push' of undefined
at Renderer.include (D:\Projects\TCP\node_modules\stylus\lib\renderer.js:187
:21)
at Renderer.<anonymous> (D:\Projects\TCP\node_modules\nib\lib\nib.js:51:11)
at Renderer.use (D:\Projects\TCP\node_modules\stylus\lib\renderer.js:203:6)
at Object.compile (D:\Projects\TCP\server.js:12:55)
at D:\Projects\TCP\node_modules\stylus\lib\middleware.js:152:31
at fs.js:334:14
at FSReqWrap.oncomplete (fs.js:95:15)
My Server.js:
var connect = require('connect'),
serveStatic = require('serve-static'),
nib = require('nib'),
stylus = require('stylus');
var app = connect();
app.use(stylus.middleware({
src : __dirname + '/public',
force : true,
compile : function compile(str, path) {
return stylus(str, path).set('filename', path).use(nib());
}
}));
app.use(serveStatic("public"));
app.listen(5000, function () {console.log("HI", __dirname);}); //works!
.style
file at public/css/tcp.styl
- out put can be the same place. what is the issue here? how to solve it?
Thanks in advance
You got this error because of this line:
Second argument of the
stylus
call should be an object with options not a string with path. In your case the call should be juststylus(str)
.