Error: spawn pandoc ENOENT
Edenharder opened this issue · 21 comments
Hi, I install Pandoc with cabal and then add its path to system path. There is no problem when I run Pandoc in terminal. But when I run hexo g, there is some error:
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn pandoc ENOENT
at exports._errnoException (util.js:837:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:429:9)
at process._tickCallback (node.js:343:17)
Hello,
This is weird. I haven't come across that.
Can it be the problem of your posts? Have you ever tried rendering only helloworld post originally created by hexo?
Hi,
I think the problem may lay the plugin cannot find the Pandoc. If I install Pandoc directly, that is, not via cabal, then everything will be Okay.
Now the Pandoc (1.15.2.1) works well, and I have added ~/.cabal/bin
to .bash_profile
:
PATH="~/.cabal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH" # Make sure to use double quotes not single quotes And on a new line
export PATH
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
But when I run hexo g, there is some error.
I delete all the posts except the hello-world.md
which contains no math formula. When I make some change to hello-world.md
, hexo g
works but hexo s
not and then hexo g
will also not:
$ hexo g
INFO Files loaded in 311 ms
INFO Generated: 2014/01/29/hello-world/index.html
INFO Generated: baidusitemap.xml
INFO Generated: atom.xml
INFO Generated: index.html
INFO Generated: sitemap.xml
INFO 5 files generated in 456 ms
$ hexo s
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn pandoc ENOENT
at exports._errnoException (util.js:837:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:429:9)
at process._tickCallback (node.js:343:17)
Is it possible that you write a js snippet independent of Hexo, which is in the same spirit with that plugin. Then I use that snippet to test a markdown file to see what happens.
hexo-renderer-pandoc is adapted from node-pdc , if you can use that package, then you should be able to use this plugin.
BTW, what's the version of your hexo environment?
hexo-cli: 0.1.8
os: Darwin 15.0.0 darwin x64
http_parser: 2.5.0
node: 4.1.1
v8: 4.5.103.33
uv: 1.7.4
zlib: 1.2.8
ares: 1.10.1-DEV
modules: 46
openssl: 1.0.2d
I install node-pdc
and run the following script with no error:
var pdc = require('pdc');
// optional, if pandoc is not in PATH
var path = require('path');
pdc.path = path.resolve(process.env.HOME, '.cabal/bin/pandoc');
pdc('# Heading', 'markdown', 'html', function(err, result) {
if (err)
throw err;
console.log(result);
});
But if I do not add the '.cabal/bin/pandoc' to pdc.path
, the error says that
internal/child_process.js:298
throw errnoException(err, 'spawn');
^
Error: spawn EACCES
at exports._errnoException (util.js:837:11)
at ChildProcess.spawn (internal/child_process.js:298:11)
at exports.spawn (child_process.js:339:9)
at pdcStream (/Users/Eden/node_modules/pdc/pdc.js:21:14)
at pdc (/Users/Eden/node_modules/pdc/pdc.js:33:14)
at Object.<anonymous> (/Users/Eden/test.js:7:1)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
Hope that the above information is helpful.
I'm wondering whether this is caused by a last pull request .
Please try replacing the index.js of hexo-renderer-pandoc with an older version, and see whether the problem is resolved.
The error is same:
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn pandoc ENOENT
at exports._errnoException (util.js:837:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:429:9)
at process._tickCallback (node.js:343:17)
I noticed that you are using Mac system. So maybe tried install pandoc via HomeBrew? That's how I install pandec, too.
And also remove all the older pandoc installations.
Yeah, I use Mac. I did install pandoc via HomeBrew before and everything work well. But now I want to use gitit, which can be installed only when I installed pandoc also via cabal.
Version conflict can be blamed.
To isolate different environments I guess you may try using some sandbox tools like Docker.
Thanks very much. It will be a long way to try using some sandbox tools like Docker, because I know very little about computer science. Is it possible to fix this issue by changing my copy of your plugin?
I'm afraid that it is little likely to fix this problem via modifying the code.
Could you explain "Version conflict can be blamed"? Why Hexo cannot use the latest Pandoc?
Well, you are trying to launch pandoc in a machine that has two version of pandoc. That maybe ambiguous to spawn to choose which version to run.
And I will suggest that you add $HOME/.cabal/bin
to .bash_profile
rather than ~/.cabal/bin
. On Mac OSX this sometimes leads to weird problems.
There is only one version of Pandoc in my machine, that is, the one installed via cabal.
I have changed ~/.cabal/bin
to $HOME/.cabal/bin
, the issue is still there.
Then I guess the cabal version of pandoc is not supported for now.
Not supported by Hexo or what? I can use this version of pandoc manually.
I don't think the cabal version of pandoc is not supported, because if I install the latest pandoc directly not via cabal or homebrew there is no odds.
This problem is related to the installation of pandoc. On Mac OSX a prefered way is to install it via Homebrew. Close this issue.