Codimd: Deploying without PhantomJS dependency

Created on 10 Dec 2017  路  5Comments  路  Source: hackmdio/codimd

Hello!
I'm trying to deploy hackmd on aarch64.
Not sure is it possible, but looks like I'm having trouble with PhantomJS only.

I've updated node:6.12.0-alpine to node:9.2.0-alpine
and postgres:9.6-alpine to postgres:10.1-alpine to support my 64bit arm device.
and uncommented build: section at docker-compose with hackmd:latest-alpine and HMD_ALLOW_PDF_EXPORT=false at environment, but getting:

PhantomJS not found on PATH                                                                                                           
Unexpected platform or architecture: linux/arm64                                                                                      
It seems there is no binary available for your platform/architecture                                                                  
Try to install PhantomJS globally

I've tried to manually put binary from mitghi phantomjs arm64 build to /usr/bin via alpine/Dockerfile -- no luck (same error)

Any hints? (I'm a noob at docker and nodejs)

P.S.: thank you for your project! :)

question

All 5 comments

To be honest, there are not many aarch64 deployments around, so happy to see, someone using it. 馃憤

The PhantomJS problem is caused by the fact, that it's still a dependency, but with HMD_ALLOW_PDF_EXPORT=false no longer used.

But no matter you'll probably run into different issues. Iirc my last tests with Node 8 and HackMD didn't turn out perfectly because of some dependencies but maybe that changes recently.

You can try to fork HackMD, move this line to the optional dependencies and update these lines in your compose file, to use your repository.

If that works, feel free to file a pull request. If not, feel free to further get help here :)

Thank you for the help!
for now yarn why phantomjs-prebuilt returning not only the markdown-pdf but codemirror too.
Didn't managed to build it with phantomjs-prebuilt as optional dependency, hope will investigate more into this task later.

It is doable. But very hacky. Just write a shellscript and place it in your PATH. It should simply return a phantomjs version string.

See:
https://github.com/Medium/phantomjs/blob/0cc1407f107f8399747015f131390247d0ff60c4/lib/util.js#L47-L61

@SISheogorath, thank you for the hint,
not sure I could implement it:

I'm adding this bash script to /usr/bin and making it executable.
The result is:

...
[4/4] Building fresh packages...
warning
Error running install script for optional dependency: "/usr/local/share/.cache/yarn/v1/.tmp/d0bae1b5a1f45048ee8c0ff9aa923ac7.14afbd8b0d8f8d1e963839edf9fc05f30ab13670.prepare/node_modules/phantomjs-prebuilt:
Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /usr/local/share/.cache/yarn/v1/.tmp/d0bae1b5a1f45048ee8c0ff9aa923ac7.14afbd8b0d8f8d1e963839edf9fc05f30ab13670.prepare/node_modules/phantomjs-prebuilt
Output:
Considering PhantomJS found at /usr/bin/phantomjs
Found PhantomJS at /usr/bin/phantomjs ...verifying
PhantomJS detected, but wrong version 2.1.12 @ /usr/bin/phantomjs.
Unexpected platform or architecture: linux/arm64
It seems there is no binary available for your platform/architecture
Try to install PhantomJS globally"
...

So looks like I didn't managed to implement the hack and deploy codemirror yet:

...
> [email protected] build /hackmd
> webpack --config webpack.production.js --progress --colors --bail

 70% 16/16 b  0% compileModuleNotFoundError: Module not found: Error: Cannot resolve 'file' or 'directory' /hackmd/node_modules/codemirror/lib/codemirror.css in /hackmd

No further progress into any direction :/ Closing for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qiuwch picture qiuwch  路  3Comments

LukasKalbertodt picture LukasKalbertodt  路  4Comments

SISheogorath picture SISheogorath  路  4Comments

Nebukadneza picture Nebukadneza  路  3Comments

ghost picture ghost  路  4Comments