Comments (12)
Similar, but slightly different problem here. Also using pandoc -F mermaid-filter
command. The error is:
[INFO] Running filter mermaid-filter
internal/fs/utils.js:269
throw err;
^
Error: ENOENT: no such file or directory, open '/tmp/tmp-57o2MEa4kbr22k.tmp.png'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at mermaid (/home/node/.npm-global/lib/node_modules/mermaid-filter/index.js:88:27)
at /home/node/.npm-global/lib/node_modules/mermaid-filter/index.js:145:12
at /home/node/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:52:19
at Array.forEach (<anonymous>)
at walk (/home/node/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:50:7)
at /home/node/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:74:16
at Array.forEach (<anonymous>)
at walk (/home/node/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:73:20) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/tmp/tmp-57o2MEa4kbr22k.tmp.png'
}
Error running filter mermaid-filter:
Filter returned error status 1
When I look at the /tmp
folder, the file is there, but without the png
extension.
/data/src # ls /tmp
tmp-57o2MEa4kbr22k.tmp
I'm trying to run inside a docker container with pandoc/latex:2.14.2
docker image.
from mermaid-filter.
Yeah, I've solved it by building a new docker image. The problem was with puppetter configuration.
Here is my dockerfile:
FROM pandoc/latex:2.14.2
RUN apk upgrade && apk add --no-cache \
nodejs==12.22.6-r0 \
npm==12.22.6-r0 \
chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
RUN npm install [email protected] -g --unsafe-perm
# Install additional LaTeX packages
RUN tlmgr update --self && tlmgr install \
pgf floatrow titling
WORKDIR /data/src
RUN echo '{"args": ["--no-sandbox","--disable-setuid-sandbox"],"executablePath": "/usr/bin/chromium-browser"}' > /tmp/.puppeteer.json
I build it with: docker build -t myimage/latest .
Then I'm able to run it with: docker run --volume "$(pwd)/src:/data/src" --entrypoint ./publish_with_docker.sh myimage/latest
My publish_with_docker.sh
script is inside $(pwd)/src
on host and contains the following:
#!/bin/sh
cp /tmp/.puppeteer.json /data/src && ./publish.sh
I'm copying the file .puppeteer.json to the WORKDIR because mermaid-filter requires it to be in working directory, as we can see here.
./publish.sh
is the script actually calling pandoc.
from mermaid-filter.
I've commented on the issue above - but to save navigating off...
Manually fettling package.json to include v0.13.0 of puppeteer within the mermaid.cli package seems to have got the mmdc working for me.
I've just tested pandoc
too .... and that works with v0.13.0
of puppeteer
from mermaid-filter.
Any news on this error? I'm facing the same issue when running pandoc on docker with my .gitlab-ci.yml using as a base image pandoc/latex
.gitlab-ci.yml here:
image:
name: pandoc/latex
entrypoint: ["/bin/sh", "-c"]
stages: # List of stages for jobs, and their order of execution
- Wiki
cloning-wiki:
stage: Wiki
artifacts:
untracked: false
expire_in: 30 days
paths:
- output/
script:
- apk add --update npm
- npm i --unsafe-perm -g mermaid-filter
- pandoc -F mermaid-filter README.md -o output/README.pdf --data-dir=./pandoc --from markdown --template eisvogel --listings
Error here:
$ pandoc -F mermaid-filter README.md -o output/README.pdf --data-dir=./pandoc --from markdown --template eisvogel --listings
internal/fs/utils.js:269
throw err;
^
Error: ENOENT: no such file or directory, open '/tmp/tmp-329AxvFrFjUH8Z8.tmp.png'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at mermaid (/builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/index.js:88:27)
at /builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/index.js:145:12
at /builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:52:19
at Array.forEach (<anonymous>)
at walk (/builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:50:7)
at /builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:74:16
at Array.forEach (<anonymous>)
at walk (/builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:73:20) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/tmp/tmp-329AxvFrFjUH8Z8.tmp.png'
}
Error running filter mermaid-filter:
Filter returned error status 1
from mermaid-filter.
Can you test with just pandoc -F
to check if things are basically working?
from mermaid-filter.
Yup, same error...
from mermaid-filter.
I'm unable to reproduce this on a fresh installation with the test.md
in the repo. Can you paste in your exact command and output with just pandoc -F mermaid-filter
?
from mermaid-filter.
Sure..
pandoc -F mermaid-filter test.md
(node:25800) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
[1204/114408.094911:FATAL:zygote_host_impl_linux.cc(123)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x561094287857 base::debug::StackTrace::StackTrace()
#1 0x56109429e041 logging::LogMessage::~LogMessage()
#2 0x56109344b711 content::ZygoteHostImpl::Init()
#3 0x5610930dfda0 content::BrowserMainLoop::EarlyInitialization()
#4 0x5610930e62de content::BrowserMainRunnerImpl::Initialize()
#5 0x561097ecddd6 headless::HeadlessContentMainDelegate::RunProcess()
#6 0x561093fd39e7 content::RunNamedProcessTypeMain()
#7 0x561093fd4421 content::ContentMainRunnerImpl::Run()
#8 0x561093fdd19d service_manager::Main()
#9 0x561093fd2f52 content::ContentMain()
#10 0x561097ecd075 headless::(anonymous namespace)::RunContentMain()
#11 0x561097ecd0ea headless::HeadlessBrowserMain()
#12 0x561093fda1b1 headless::HeadlessShellMain()
#13 0x561092a3c1bd ChromeMain
#14 0x7f30477dbf6a __libc_start_main
#15 0x561092a3c029 <unknown>
Received signal 6
#0 0x561094287857 base::debug::StackTrace::StackTrace()
#1 0x5610942873bf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7f304dbf6da0 <unknown>
#3 0x7f30477ef8a0 __GI_raise
#4 0x7f30477f0f09 __GI_abort
#5 0x561094286402 base::debug::BreakDebugger()
#6 0x56109429e42a logging::LogMessage::~LogMessage()
#7 0x56109344b711 content::ZygoteHostImpl::Init()
#8 0x5610930dfda0 content::BrowserMainLoop::EarlyInitialization()
#9 0x5610930e62de content::BrowserMainRunnerImpl::Initialize()
#10 0x561097ecddd6 headless::HeadlessContentMainDelegate::RunProcess()
#11 0x561093fd39e7 content::RunNamedProcessTypeMain()
#12 0x561093fd4421 content::ContentMainRunnerImpl::Run()
#13 0x561093fdd19d service_manager::Main()
#14 0x561093fd2f52 content::ContentMain()
#15 0x561097ecd075 headless::(anonymous namespace)::RunContentMain()
#16 0x561097ecd0ea headless::HeadlessBrowserMain()
#17 0x561093fda1b1 headless::HeadlessShellMain()
#18 0x561092a3c1bd ChromeMain
#19 0x7f30477dbf6a __libc_start_main
#20 0x561092a3c029 <unknown>
r8: 0000000000000000 r9: 00007ffdae1816e0 r10: 0000000000000008 r11: 0000000000000246
r12: 00007ffdae181e00 r13: 0000000000000161 r14: 00007ffdae181df8 r15: 00007ffdae181df0
di: 0000000000000002 si: 00007ffdae1816e0 bp: 00007ffdae1819a0 bx: 0000000000000006
dx: 0000000000000000 ax: 0000000000000000 cx: 00007f30477ef8a0 sp: 00007ffdae1816e0
ip: 00007f30477ef8a0 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
(node:25800) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
fs.js:1081
return binding.unlink(pathModule.toNamespacedPath(path));
^
Error: ENOENT: no such file or directory, unlink '/tmp/tmp-25794sbFMJGl9po1k.tmp.png'
at Object.fs.unlinkSync (fs.js:1081:18)
at mv (/home/haozeke/.config/yarn/global/node_modules/mermaid-filter/index.js:102:8)
at mermaid (/home/haozeke/.config/yarn/global/node_modules/mermaid-filter/index.js:73:9)
at /home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:52:19
at Array.forEach (<anonymous>)
at walk (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:50:7)
at /home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:74:16
at Array.forEach (<anonymous>)
at walk (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:73:20)
at filter (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:36:10)
Error running filter mermaid-filter:
Filter returned error status 1
Also if it helps,
pandoc -v
pandoc 2.0.1.1
Compiled with pandoc-types 1.17.2, texmath 0.10, skylighting 0.4.3.2
Default user data directory: /home/haozeke/.pandoc
Copyright (C) 2006-2017 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
from mermaid-filter.
I'm able to reproduce the issue only on Linux. Windows works fine. ATM, I'm not quite sure what's going on - but it looks like files being created by mermaid cli are somehow deleted/removed by the time the filter tries to pick them up.
from mermaid-filter.
From monitoring my /tmp
folder I notice that there is no tmp/tmp-*.tmp.png
file being created at all...
I notice a pupeteer* folder being created and deleted along with a file (renamed to have .txt at the end) being produced in /tmp/
from mermaid-filter.
Looks like this issue 16 in mermaid.cli might be where the trouble is.
from mermaid-filter.
I'm trying to run the following command in a docker container:
pandoc -f gfm -s Work-log.md -t html --pdf-engine=wkhtmltopdf --filter pandoc-mermaid --variable "geometry=margin=0.5in" -o Work-log.pdf
It's erring out due to no sandbox. I've tried creating the .puppeteer.json file with the contents of {"args": ["--no-sandbox"]}
but it doesn't seem to be passing it in.
Traceback (most recent call last):
File "/usr/local/bin/pandoc-mermaid", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/pandoc_mermaid_filter.py", line 38, in main
toJSONFilter(mermaid)
File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 148, in toJSONFilter
toJSONFilters([action])
File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 182, in toJSONFilters
sys.stdout.write(applyJSONFilters(actions, source, format))
File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 213, in applyJSONFilters
altered = walk(altered, action, format, meta)
File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 141, in walk
return {k: walk(v, action, format, meta) for k, v in x.items()}
File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 141, in <dictcomp>
return {k: walk(v, action, format, meta) for k, v in x.items()}
File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 128, in walk
res = action(item['t'],
File "/usr/local/lib/python3.9/dist-packages/pandoc_mermaid_filter.py", line 31, in mermaid
subprocess.check_call([MERMAID_BIN, "-i", src, "-o", dest])
File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/mmdc', '-i', 'mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.mmd', '-o', 'mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.svg']'
Noticing the "subprocess" command at the bottom I went into the an instance of the Docker container I manually ran it /usr/local/bin/mmdc -i mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.mmd -o mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.svg
and it gave me the following:
Error: Failed to launch the browser process!
[0703/000132.577638:FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
...
...
...
Running it manually again as /usr/local/bin/mmdc -p .puppeteer.json -i mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.mmd -o mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.svg
passing in the .puppeteer.json file however works (notice that .puppeteer.json already exsisted in the working directory)...
Is there a way we can force pandoc or pandoc-mermaid-filter to pass in the -p flag to mmdc instead of relying on "auto[fail]" to find it?
P.S.
$ pandoc -v
pandoc 2.9.2.1
Compiled with pandoc-types 1.20, texmath 0.12.0.2, skylighting 0.8.5
Default user data directory: /home/zimmy/.local/share/pandoc or /home/zimmy/.pandoc
Copyright (C) 2006-2020 John MacFarlane
Web: https://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
$ node -v
v12.22.12
$ npm list -g puppeteer
/usr/local/lib
`-- @mermaid-js/[email protected]
`-- [email protected]
from mermaid-filter.
Related Issues (20)
- list of options? HOT 1
- can we place nodes relative to each other? HOT 1
- Publishing a new NPM release HOT 1
- Please upgrade to mermaid-cli v9 HOT 4
- Allow embedding `svg` directly into the HTML document HOT 1
- DeprecationWarning: Buffer() is deprecated
- Google slides fail to show mermaid images embeded on pptx using mermaid-filter HOT 1
- Need to install librsvg on Mac to use SVG format HOT 1
- fantastic news, sequenceDiagram working with Chinese characters too.
- Mermaid Ink Save Path Option
- Cannot Generate `gitGraph` Images HOT 4
- is it possible to specify height?
- -
- Filter fails with config or CSS file when path has spaces HOT 3
- environment configuration variable MERMAID_FILTER_BACKROUND is misspelled
- Add option to disable creation of mermaid-filter.err HOT 4
- /includegraphic Support
- Does the filter work when converting to PowerPoint pptx format? HOT 1
- can't specify options via pandoc HOT 4
- Environment variable not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mermaid-filter.