there4 / markdown-resume

Generate a responsive CSS3 and HTML5 resume with Markdown, with optional PDF output.
MIT License
1.77k stars 519 forks source link

Please run `composer install` to install dependencies #65

Closed asbjornu closed 6 years ago

asbjornu commented 6 years ago

After going through the required steps to get there4/markdown-resume and all of its dependencies (leafo/scssphp, symfony/event-dispatcher) installed with composer, I now have the ./vendor/bin/md2resume binary available. But executing it only yields the following:

Please run composer install to install dependencies

However, executingcomposer install doesn't actually install anything because everything seems to be installed:

Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating autoload files

Ideas on what I might be missing or doing wrong?

asbjornu commented 6 years ago

I've dug around and found that the error message Please runcomposer installto install dependencies comes from bin/md2resume because it can't find the file /vendor/autoload.php.

I've checked and the file is there, but since I'm running markdown-resume from where it is installed with Composer (./vendor/bin/md2resume), the relative path to autoload.php is different. I'll see if I can figure out how to fix this in a PR.

nkanderson commented 6 years ago

I've just run into this issue, getting the message The dependency '' was not found. Please run `composer install` to install dependencies. when trying to run the example command from the readme quickstart section, ./bin/md2resume html examples/source/sample.md examples/output/.

I installed via git clone, with the default directory name of "markdown-resume". As a result, the logic in PR #66 checking basename($baseDir) against the string markdown-resume returns true, and assigns a non-existent file (or rather, realpath returns false) for $autoloadPath.

I'd be happy to create a new PR, but could use a recommendation on how to ensure a proper autoload file location. If the current logic is good, but not specific enough, would it make sense to use dirname to check if md2resume is being run from within a vendor directory?

nkanderson commented 6 years ago

@asbjornu should I open a new ticket for this issue, with the use case of installing via git clone? Or does it make sense to re-open this one?

asbjornu commented 6 years ago

@nkanderson: Good question. What I would love was if we were able to concoct some tests for these scenarios so we don't break one use-case every time we fix another, whack-a-mole style. Perhaps @craig-davis has ideas for how we can add some automated tests for this?

ddulic commented 6 years ago

Same problem when trying to run from a docker container. Anyone have any tips?

FROM php:7-cli
VOLUME /examples
ENV DEBIAN_FRONTEND noninteractive
RUN docker-php-ext-install mbstring
RUN apt-get update && apt-get -qqy install wget wkhtmltopdf git unzip xvfb
RUN wget https://github.com/there4/markdown-resume/archive/master.zip && unzip master.zip && mv markdown-resume-master markdown-resume
RUN cd markdown-resume && curl --silent --show-error https://getcomposer.org/installer | php \
    && ./composer.phar update && chmod +x ./bin/md2resume && ls -alh ./vendor/bin
CMD cd markdown-resume && xvfb-run ./bin/md2resume pdf --template readable /examples/source/ddulic.md /examples/output/
~/Projects/markdown-resume-master
❯ docker run --rm -t -i -e DISPLAY -v $PWD/examples:/examples:rw ddulic/resume

46

nkanderson commented 6 years ago

@ddulic As a quick fix, I changed the $autoloadPath in bin/md2resume to the following: $autoloadPath = $baseDir . '/vendor/autoload.php

There's a line with a ternary that assigns to $autoloadPath conditionally based on the name of the base directory, but in my case of installing via git clone, it does so incorrectly.

ddulic commented 6 years ago

Thanks @nkanderson for the fix. Did a fork and implemented it for my own needs. It seems this problem also occurred even if I downloaded the zip but renamed the folder.