dbashford / mimosa-server-template-compile

A mimosa module for compiling server templates as part of a build
3 stars 1 forks source link

Cannot compile jade templates #3

Closed hfjallemark closed 11 years ago

hfjallemark commented 11 years ago

I am getting the following error:

/usr/local/lib/node_modules/mimosa/node_modules/mimosa-bower/node_modules/bower/node_modules/tmp/lib/tmp.js:261
  throw err;
        ^
Error: Cannot find module 'then-jade'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.exports.jade (/Volumes/Data/Dev/Dash/node_modules/mimosa-server-template-compile/node_modules/consolidate/lib/consolidate.js:161:32)
    at /Volumes/Data/Dev/Dash/node_modules/mimosa-server-template-compile/lib/index.js:44:32
    at Array.forEach (native)
    at Array._compileTemplates [as 0] (/Volumes/Data/Dev/Dash/node_modules/mimosa-server-template-compile/lib/index.js:39:23)
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:267:26)
    at WorkflowManager.module.exports.WorkflowManager._workflowMethod (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:279:12)
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:237:22)
    at cb (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:246:16)
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:269:16)
    at cb (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:276:16)
    at Array._buildDone [as 0] (/usr/local/lib/node_modules/mimosa/node_modules/mimosa-require/lib/plugin.js:226:10)
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:267:26)
    at WorkflowManager.module.exports.WorkflowManager._workflowMethod (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:279:12)
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:237:22)
    at cb (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:246:16)
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:269:16)
    at cb (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:276:16)
    at Array._mergeAll [as 0] (/Volumes/Data/Dev/Dash/node_modules/mimosa-combine/lib/index.js:79:10)
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:267:26)
    at WorkflowManager.module.exports.WorkflowManager._workflowMethod (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:279:12)
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:237:22)
    at WorkflowManager.module.exports.WorkflowManager._executeWorkflowStep (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:249:12)
    at WorkflowManager.module.exports.WorkflowManager._buildDone (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:315:17)
    at WorkflowManager._buildDone (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:2:59)
    at /usr/local/lib/node_modules/mimosa/lib/util/workflow.js:307:24
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:239:16)
    at cb (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:246:16)
    at next (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:269:16)
    at cb (/usr/local/lib/node_modules/mimosa/lib/util/workflow.js:276:16)
    at done (/usr/local/lib/node_modules/mimosa/lib/modules/file/write.js:35:16)
    at /usr/local/lib/node_modules/mimosa/lib/modules/file/write.js:52:16
    at /usr/local/lib/node_modules/mimosa/lib/util/file.js:66:12
    at /usr/local/lib/node_modules/mimosa/node_modules/mimosa-bower/node_modules/bower/node_modules/graceful-fs/graceful-fs.js:103:5
    at /usr/local/lib/node_modules/mimosa/node_modules/skelmimosa/node_modules/rimraf/node_modules/graceful-fs/graceful-fs.js:103:5
    at Object.oncomplete (fs.js:107:15)

If I manually install either jade or then-jade in my project folder it works.

dbashford commented 11 years ago

Consolidate, the library this module wraps, relies on you having jade installed. If you are compiling "server templates", then for them ever to work pre-compiled, like via Express, then you would have needed jade at some point. Usually this is taken care of by "mimosa-server", but that is just a pleasant side effect.

In other words, if you are using jade on the server, you need jade anyway, so this module doesn't bother including it. I think that's how I'd prefer to keep it, rather than including all the possible modules now and in the future.

That makes sense?

I guess you are not using mimosa-server in this particular case?

At the very least this bears some documentation updates to make it clear you need to BYOC. I'll do that now.

hfjallemark commented 11 years ago

It works when running mimosa watch -sd but not when running mimosa build.

So I need to run npm install jade in the directory where my mimosa-config is?

dbashford commented 11 years ago

Going to backtrack. I'm going to go ahead and just require in those libraries into the module. Might not be the right thing to do from a design perspective, but its the right UX for the module.

hfjallemark commented 11 years ago

I agree:-) Thanks David.

dbashford commented 11 years ago

0.4.1 is pushed to NPM. I didn't have a second to test it, have to jump into something else, but all I believe I needed to do was include the libraries in the app. So no code changed. All should be good now. Let me know if you have any trouble! Thanks!

hfjallemark commented 10 years ago

Works excellent, thanks!