Skip to content

Unable to run markbind serve from another directory #842

Description

@marvinchin

Tell us about your environment

  • MarkBind Version: v2.2.0

What did you do? Please include the actual source code causing the issue.

From markbind directory run markbind serve docs

What did you expect to happen?

Site should build correctly.

What actually happened? Please include the actual, raw output.

Got errors:

error: uncaughtException: Template render error: (/Users/marvinchin/Documents/Workspace/markbind/docs/userGuide/usingHtmlJavaScriptCss.md)
  Error: template not found: njk/common.njk date=Sun Apr 21 2019 11:26:25 GMT+0800 (+08), pid=6066, uid=501, gid=20, cwd=/Users/marvinchin/Documents/Workspace/markbind, execPath=/Users/marvinchin/.nvm/versions/node/v8.15.1/bin/node, version=v8.15.1, argv=[/Users/marvinchin/.nvm/versions/node/v8.15.1/bin/node, /usr/local/bin/markbind, serve, docs], rss=109539328, heapTotal=78528512, heapUsed=45915760, external=333846, loadavg=[1.16650390625, 1.2783203125, 1.58837890625], uptime=1698463
Template render error: (/Users/marvinchin/Documents/Workspace/markbind/docs/userGuide/usingHtmlJavaScriptCss.md)
  Error: template not found: njk/common.njk
    at Object._prettifyError (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/lib.js:36:11)
    at /usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/environment.js:567:19
    at eval (eval at _compile (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/environment.js:637:18), <anonymous>:22:11)
    at createTemplate (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/environment.js:295:11)
    at next (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/lib.js:282:7)
    at handle (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/environment.js:329:11)
    at /usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/environment.js:339:9
    at next (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/lib.js:280:7)
    at Object.asyncIter (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/lib.js:286:3)
    at Environment.getTemplate (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/environment.js:321:9)
    at Template.root [as rootRenderFunc] (eval at _compile (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/environment.js:637:18), <anonymous>:21:5)
    at Template.render (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/environment.js:556:10)
    at Environment.renderString (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/src/environment.js:380:17)
    at Object.renderString (/usr/local/lib/node_modules/markbind-cli/node_modules/nunjucks/index.js:99:14)
    at fs.readFile (/usr/local/lib/node_modules/markbind-cli/src/lib/markbind/src/parser.js:530:36)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

This is caused by njk references not using relative paths (e.g. njk and includes). I'm not sure if this is expected behaviour (i.e. links should be relative or absolute), or if we should reference all paths from the root folder of the site.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions