BlueHatbRit / mdpdf

Markdown to PDF command line app with support for stylesheets

Home Page:https://npmjs.com/package/mdpdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EXDEV: cross-device link not permitted

jooola opened this issue · comments

I'm facing this issue with Atom. Any chances to fix this ?

Error: EXDEV: cross-device link not permitted, rename '/home/jo/github/markdown-to-pdf/_temp.html' -> '/tmp/debug.html'
    at Object.renameSync (fs.js:591)
    at writeFile.then.then.then.then.then.then (/home/jo/github/markdown-to-pdf/node_modules/mdpdf/src/index.js:199)
    at tryCatcher (/home/jo/github/markdown-to-pdf/node_modules/bluebird/js/release/util.js:16)
    at Promise._settlePromiseFromHandler (/home/jo/github/markdown-to-pdf/node_modules/bluebird/js/release/promise.js:547)
    at Promise._settlePromise (/home/jo/github/markdown-to-pdf/node_modules/bluebird/js/release/promise.js:604)
    at Promise._settlePromise0 (/home/jo/github/markdown-to-pdf/node_modules/bluebird/js/release/promise.js:649)
    at Promise._settlePromises (/home/jo/github/markdown-to-pdf/node_modules/bluebird/js/release/promise.js:729)
    at _drainQueueStep (/home/jo/github/markdown-to-pdf/node_modules/bluebird/js/release/async.js:93)
    at _drainQueue (/home/jo/github/markdown-to-pdf/node_modules/bluebird/js/release/async.js:86)
    at Async._drainQueues (/home/jo/github/markdown-to-pdf/node_modules/bluebird/js/release/async.js:102)
    at Async.drainQueues (/home/jo/github/markdown-to-pdf/node_modules/bluebird/js/release/async.js:15)

This is because mdpdf first creates the html file as _temp.html in your directory. It then attempts to rename this to debug.html. I'm not sure why it's getting /tmp/debug.html though as it should be forcing it into the same directory as your md to put them together.

How are you trying to run mdpdf, what options is it recieving?

Hey @BlueHatbRit , just getting back to testing this in atom markdown-pdf package, and this is the error I get as well. I think @jooola is running into it in the same context (converting the README.md from the markdown-pdf repo).

This is the offending line from my package:

https://github.com/travs/markdown-pdf/blob/8c06498bfc8461bafcb636c636551dcaf035567d/lib/markdown-pdf.js#L93

I will make it default to the same directory as the PDF being generated instead of /tmp/, so markdown-pdf doesn't have this issue.

I think something funky is still going on here though, since the user running the atom process should have permission to write to /tmp.


Ok, I got it now: https://stackoverflow.com/a/43206506/4063844

/tmp is on a different disk device for me, so the rename doesn't work apparently.
One way, according to that SO comment, would be to copy then remove the old file.

Thanks for the added detail here @travs, the PR looks good to me. I just want to spend a few minutes giving it a good test in a few different scenarios to check everything is ok. If that's all good then I'll roll this into a patch release.

This has been fixed in 2.1.1 🎊