ActiveCampaign / postmark-cli

The official CLI tool for Postmark
https://postmarkapp.com
MIT License
79 stars 9 forks source link

Template Preview fails #21

Closed SeriousM closed 4 years ago

SeriousM commented 4 years ago

Hi!

When I open templates preview <path> I get an error when I open the server:

{
  "errno":-4058,
  "code":"ENOENT",
  "syscall":"open",
  "path":"C:\\dev\\MailTemplates\\preview\\index.ejs"
}

The path C:\dev\MailTemplates\preview doesn't even exist nor do I have an *.ejs file somewhere.

Is there anything I can do about it?

derekrushforth commented 4 years ago

Hey @SeriousM! Sorry about the issues. Can you run postmark --version and tell me which version you're using?

SeriousM commented 4 years ago

It was fresh installed from npm, but I'm not at my work place to look it up.

SeriousM commented 4 years ago

Alright, holidays over, here the required information.

    "postmark": "2.3.4",
    "postmark-cli": "1.3.6",
viperfx commented 4 years ago

I get the same error

{"errno":-2,"code":"ENOENT","syscall":"open","path":"/Users/viperfx/.config/yarn/global/preview/index.ejs"}

Using latest version 1.4.6

mattjennings commented 4 years ago

I'm also getting the same error. A workaround for this is use the following URLs and replacing my-alias with whichever template alias you want to preview

html preview: http://localhost:3005/html/my-alias

text preview: http://localhost:3005/text/my-alias

derekrushforth commented 4 years ago

I'll get to the bottom of this issue. Sorry about the trouble, folks.

@mattjennings What OS are you using? And are you installing this via npm or yarn?

mattjennings commented 4 years ago

macOS 10.15.3 and we're using yarn. It's installed in a monorepo as a project dependency, as well, and the path in my error points to the root directory of my monorepo:

"path":"/Users/mattjennings/dev/ttq/monorepo/preview/index.ejs"

/Users/mattjennings/dev/ttq/monorepo/node_modules/postmark-cli is where the package is installed.

I gave a quick look into the repo and it looks like this is the cause

https://github.com/wildbit/postmark-cli/blob/967140b3c27dc87851d9d9847578f74ca731d4cc/src/commands/templates/preview.ts#L15

derekrushforth commented 4 years ago

@mattjennings Thanks for the info. Yeah, that's definitely the issue. I just need to figure out why it's not working with yarn. npm seems to be fine though.

viperfx commented 4 years ago

@derekrushforth so the work around right now is to use npm install and run with npm?

can you share your npm and node version.

derekrushforth commented 4 years ago

Hey folks, can you install the latest version(1.4.7) of the CLI tool? I just pushed up a fix.

I've tested this using npm v6.13.4 and yarn v1.22.4.

mattjennings commented 4 years ago

working as expected now! thanks for the fix.

derekrushforth commented 4 years ago

Closing this issue out. Feel free to open it back up if anyone is still having issues.