mjmlio / mjml2json

A package to convert a MJML template from XML syntax to JSON
22 stars 17 forks source link

Attempting to run #4

Closed fredxwin closed 4 years ago

fredxwin commented 5 years ago

Hi,

I have ran and installed this package but finding it difficult to run the converter as I am looking into learning MJML. I am rather new at this and still getting into Javascript.

`node mjml2json .\test\fixtures\styleguide.mjml output.html [-s] internal/modules/cjs/loader.js:550 throw err; ^

Error: Cannot find module 'C:\Downloads\mjml2json-master\mjml2json-master\mjml2json' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15) at Function.Module._load (internal/modules/cjs/loader.js:475:25) at Function.Module.runMain (internal/modules/cjs/loader.js:695:10) at startup (internal/bootstrap/node.js:201:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)`

ngarnier commented 5 years ago

Did you install mjml2json in the folder you are in? Why do you have so many nested folders (mjml2json-master\mjml2json-master\mjml2json) when 1 would be enough?

Also, it's hard to tell what you are doing. Are you trying to run node mjml2json .\test\fixtures\styleguide.mjml output.html [-s]? In that case that's normal as it's not how it works. You should run like described in the readme, try mjml2json -V.

fredxwin commented 5 years ago

Hi,

Thanks for a speedy response.

mjml.app> mjml2json .\test.mjml .\out.json [-s] The system cannot find the path specified.

I have yarn mjml2json and also installed mjml. The CLI is there but when I try to run it I get the above. Do I need to modify anything as it is all in one folder

Thanks

ngarnier commented 5 years ago

The installation instructions are here: https://github.com/mjmlio/mjml2json#installation. As you can see, you should install via NPM or Yarn, not by downloading as a zip.

Error: Cannot find module 'C:\Downloads\mjml2json-master\mjml2json-master\mjml2json' means it was not properly installed. So please start again in a fresh folder by installing mjml2json as specified in the documentation. You do not need MJML to use mjml2json, and you should avoid global install, prefer a local install instead (and uninstall the global one).

Then, use like specified in the documentation as well: mjml2json input.mjml output.json. -s is an option so shouldn't be between brackets: it's either mjml2json input.mjml output.json or mjml2json input.mjml output.json -s.