mjmlio / mjml

MJML: the only framework that makes responsive-email easy
https://mjml.io
MIT License
16.86k stars 948 forks source link

Cannot run example `./node_modules/.bin/mjml index.mjml` as shown on download page #799

Closed nealoke closed 6 years ago

nealoke commented 6 years ago

Hi, I'm trying to set this up however it seems that I cannot get it to work when following the steps on the download page.

When trying to do ./node_modules/.bin/mjml index.mjml it shows the following error in my console:

'.' is not recognized as an internal or external command,
operable program or batch file.

Also get an error when trying to add it to the PATH: export PATH="$PATH:./node_modules/.bin"

'export' is not recognized as an internal or external command,
operable program or batch file.

Versions: mjml: 3.3.3 node: 6.10.1 npm: 3.10.9

Am I doing something wrong?

iRyusa commented 6 years ago

Hi @nealoke

I think you're on Windows so you can remove the first . and then it will works for the first command. /node_modules/.bin/mjml index.mjml

And this PATH editing method is only for Linux/Mac users so that's why it doesn't work too

nealoke commented 6 years ago

@iRyusa thanks for the fast response however trying to run /node_modules/.bin/mjml /src/results/daily.mjml gives me the following error: The system cannot find the path specified.

Do I need to do npm run or something before the actual command?

iRyusa commented 6 years ago

I have no Windows bash to try here, are you in the folder where you've npm install ? Try to remove the first / too maybe

nealoke commented 6 years ago

Yes I am 😄 Also looking at my folder structure I can see that it is present in node_modules/.bin/mjml.

Trying without the first / gives me the following error:

'node_modules' is not recognized as an internal or external command,
operable program or batch file.
aakash-stockpile commented 6 years ago

Quick question, is this in Windows cmd, Powershell, or Bash for Windows Subsystem?

nealoke commented 6 years ago

@aakash-stockpile this is in the windows cmd (running inside vscode)

iRyusa commented 6 years ago

Did you tried with \ instead of / ?

aakash-stockpile commented 6 years ago

Specifically, \node_modules\.bin\mjml \src\results\daily.mjml

nealoke commented 6 years ago

@aakash-stockpile @iRyusa still not 😢 , i am currently using the gulp plugin and that works great 👍

iRyusa commented 6 years ago
node_modules\.bin\mjml -V
3.3.3

On my windows it's working are you sure you're in the good directory ?

millette commented 6 years ago

There could be an mjml script line in package.json:

"scripts": {
  "mjml": "mjml",
  "lint": "eslint ."
},

Then we can do either

npm run mjml -- -V # must use -- before passing options

or

yarn mjml -V # if you prefer yarn to npm

This works because inside a package script, node_modules/.bin is automatically included in the searched paths.

iRyusa commented 6 years ago

I think it does work on top level package json script in dependencies are only available through npm explore mjml

CF NPM documentation :

Scripts from dependencies can be run with npm explore <pkg> -- npm run <stage>.

campusman commented 6 years ago

Ran into this same issue on Win10 x64. This worked for me in the end. Use \ instead of / and no preceeding \ in front of the node_modules.

node_modules\.bin\mjml testemail.mjml -o testemail.html

Mohamed-Karkotly commented 1 year ago

export command is valid only for unix shells. In Windows - use set instead of export

This following worked for me:

set PATH="${PATH}:${.\node_modules\.bin}"