Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when using relative local theme path it raises "TypeError: Cannot read property 'join' of undefined" #493

Open
Ex-Ark opened this issue Jan 15, 2021 · 8 comments

Comments

@Ex-Ark
Copy link

Ex-Ark commented Jan 15, 2021

Env

node v14.15.4
resume-cli v3.0.4

Error

(node:11456) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'join' of undefined at _default (/usr/local/lib/node_modules/resume-cli/build/render-html.js:24:28)

Expected behaviour

Providing relative local theme path (i.e resume export --theme . resume export --theme ../json-resume-theme-kendall/ should not raise error from within resume-cli lib.

Full error stack

resume export --theme . --format html /tmp/out.html
(node:11456) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'join' of undefined
    at _default (/usr/local/lib/node_modules/resume-cli/build/render-html.js:24:28)
    at createHtml (/usr/local/lib/node_modules/resume-cli/build/export-resume.js:84:46)
    at module.exports (/usr/local/lib/node_modules/resume-cli/build/export-resume.js:36:5)
    at Command.<anonymous> (/usr/local/lib/node_modules/resume-cli/build/main.js:67:5)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 0)
    at async /usr/local/lib/node_modules/resume-cli/build/main.js:79:3
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11456) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:11456) [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.

Hints

Due to recent changes (#469) when providing theme using . the path is not initialized inside render-html.js

see my comment on the changes directly

Temp fix

if you pass the theme without using relative path then it no longer crashes because path.join is not called on undefined object.

with absolute path instead :

resume export --theme /home/user/jsonresume-theme-kendall --format html
/tmp/out.html

Done! Find your new .html resume at:
 /tmp/out.html
@antialias
Copy link
Contributor

Thanks for your report and investigation @Ex-Ark. I just put up a PR that should fix the issue. It also includes tests to ensure that this doesn't happen again :) #494

@hyperfocus1337
Copy link

hyperfocus1337 commented Jan 16, 2021

Having the same problem, however, using an absolute path also doesn't work for me, getting the following output

resume export --theme /home/user/Repositories/cv/resume-json --resume resume.json --format html          
Please enter a export destination.

After adding resume naming

resume export --theme /home/user/Repositories/cv/resume-json --resume resume.json --format html resume123       

Gives back

(node:309968) UnhandledPromiseRejectionWarning: Error: theme path jsonresume-theme-/home/user/Repositories/cv/resume-json could not be resolved from current working directory
    at _default (/home/user/.nvm/versions/node/v11.15.0/lib/node_modules/resume-cli/build/render-html.js:43:11)
    at createHtml (/home/user/.nvm/versions/node/v11.15.0/lib/node_modules/resume-cli/build/export-resume.js:84:46)
    at module.exports (/home/user/.nvm/versions/node/v11.15.0/lib/node_modules/resume-cli/build/export-resume.js:36:5)
    at Command.program.command.description.action (/home/user/.nvm/versions/node/v11.15.0/lib/node_modules/resume-cli/build/main.js:67:5)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
(node:309968) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:309968) [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.

Current working directory is identical to the error output above

pwd
/home/user/Repositories/cv/resume-json

Using this version the CLI

resume --version
3.0.4

The theme in the folder is identical to the boilerplate theme, just started developing a custom theme.

Not sure what's left to try, hopefully the PR gets merged soon

@hyperfocus1337
Copy link

hyperfocus1337 commented Jan 16, 2021

What's the last functioning version to export a local theme that's still in development, and what command would I use? I reproduced the same error on 3.0.3, and 3.0.2/3.0.1/3.0.0 are giving me different errors. Or I guess I'll have to be patient for now.

@kethanva
Copy link

kethanva commented Feb 6, 2021

I too am facing the same problem. This problem is not visible on 3.0.0. I haven't tested it on 3.0.3, and 3.0.2/3.0.1.
Should I test it and post my findings?

@kethanva
Copy link

kethanva commented Mar 4, 2021

Any update on this?

@davidjb
Copy link

davidjb commented Mar 4, 2021

Still an issue on 3.0.4, freshly installed just now. Using an absolute path also fails as @hyperfocus1337 has found:

Error: theme path jsonresume-theme-/home/davidjb/resume/theme could not be resolved from current working directory

@Ex-Ark
Copy link
Author

Ex-Ark commented Mar 5, 2021

Still an issue for me as well, but the proposed fix #494 is still pending
They probably won't release a minor just for this fix, guess we'll have to wait more changes

To be clear

Using an absolute path also fails

My absolute path works only for the export --format html command, I too cannot use relative theme nor absolute theme with serve command

@davidjb
Copy link

davidjb commented Mar 5, 2021

Applying the patch from #494 resolves the issue for me. Using Yarn’s patch protocol is one way of avoiding needing an official release, e.g. https://github.com/davidjb/cv/blob/master/package.json#L28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants