So I'm following the MJML documentation for basic installation. I successfully install. I run npm list in my project folder and MJML appears there.
However, when I run mjml -v the following error appears
-bash: mjml: command not found
Terminal output for when I run which Node
/usr/local/bin/node
Content of my .bashrc is empty at the moment. I previously added export PATH="$PATH:./node_modules/.bin" but this made no difference.
Using a Macbook air, High Sierra and Terminal.
Hi @ssosina
Weird, looks like a path issue. If you do a ./node_modules/.bin/mjml -V what does it return ?
edited: typos
Thanks for the quick reply.
This is what I get
-bash: ./node_modules/.bin: No such file or directory
I uninstalled and attempted to reinstall. It doesn't load the node module files into the folder :/
Well did you done a folder like workspace and npm init inside it ?
Then you can do an npm install mjml and it should work in this folder.
(I think in recent npm release, you no longer need to npm init)
Thats the first thing I usally do @iRyusa
Steps:
est-emailnpm initnpm install mjmlnpm list – I can see mjml and all it dependencies.mjml -v result is -bash: mjml: command not found-bash: ./node_modules/.bin: is a directoryDo I create .bash_profile or .bashrc on my platform?
You're missing a / in /node_modules/.bin/mjml
Can you echo $PATH too to check if the PATH is ok ?
Edit: my bad, i did a typo in my original reply fixed it
I should have picked up on that.
Right it shows the version now –
Locals-MacBook-Air:test-email user$ ./node_modules/.bin/mjml -V
3.3.5
This is what I get when i get echo the path:
Locals-MacBook-Air:test-email user$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I think it's a .bash_profile in OSX but I'm not 100% sure about it
@iRyusa Hmm. I added it to a bash_profile instead. even tried with bashr yet no difference.
check this out.
Locals-MacBook-Air:test-email user$ mjml -v
-bash: mjml: command not found
Locals-MacBook-Air:test-email user$ ./node_modules/.bin/mjml -V
3.3.5
Locals-MacBook-Air:test-email user$
Can you echo $PATH again to see if the path is ok
I now advise to follow the npm-exec path like this https://stackoverflow.com/questions/9679932/how-to-use-package-installed-locally-in-node-modules to avoid some kind of nasty package that could replace a common cmd line
Sure, see below.
Locals-Air:test-email user$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:./node_modules/.bin
So
$ pwd
$ ls
$ echo $PATH
$ mjml -V
In order to double check everything ? :)
Locals-Air:~ user$ cd desktop
Locals-Air:desktop user$ cd fs-email
Locals-Air:test-email user$ pwd
/Users/user/desktop/test-email
Locals-Air:test-email user$ ls
test.html index.html node_modules
test.mjml index.mjml package.json
Locals-Air:test-email user$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Locals-Air:test-email user$ mjml -v
-bash: mjml: command not found
Locals-Air:test-email user$
Yeah so your $PATH isn't updated, I don't know why it doesn't read your bashrc/bashprofile and there's not really much we can do about this :/
Sorry, but I'm closing the issue.
Same issue here. Did you ever get this fixed?
If you've installed it locally just use npm-exec mjml or yarn mjml it's
now the safest way to use cli binary
On Wed, May 29, 2019 at 2:47 AM TidyIQ notifications@github.com wrote:
Same issue here. Did you ever get this fixed?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/mjmlio/mjml/issues/885?email_source=notifications&email_token=AAELHTOVDUORW7YJU775FRTPXXHCBA5CNFSM4EDYV6AKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWN22PA#issuecomment-496741692,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAELHTOR26JOOJZVKKY7AP3PXXHCBANCNFSM4EDYV6AA
.
I too had this issue. Running mjml input.mjml -o output.html doesn't work.
However, in my package.json adding a command like "compile":"mjml input.mjml -o output.html" works
However, in my package.json adding a command like "compile":"mjml input.mjml -o output.html" works
@kostimarko this worked for me, thanks for this!
I too had this issue. Running
mjml input.mjml -o output.htmldoesn't work.However, in my
package.jsonadding a command like"compile":"mjml input.mjml -o output.html"works
Hello, Kosti. Can you tell where exactly you put this command in package.jason ?
@sasha150187 From what it sounds like, I have a similar setup to @kostimarko. Put the script in the scripts section of package.json.
It'd look something like this:
// package.json
...
"scripts": {
"start": // some other script,
"compile": mjml input.mjml -o output.html
}
...
Newer npm comes with npx, so you should be able to do npx mjml too
@sasha150187 From what it sounds like, I have a similar setup to @kostimarko. Put the script in the
scriptssection of package.json.It'd look something like this:
// package.json ... "scripts": { "start": // some other script, "compile": mjml input.mjml -o output.html } ...
@probablyabear you got to it before me :)
Most helpful comment
I too had this issue. Running
mjml input.mjml -o output.htmldoesn't work.However, in my
package.jsonadding a command like"compile":"mjml input.mjml -o output.html"works