Mjml: Issue trying to run mjml on ubuntu "mjml: command not found"

Created on 6 Apr 2017  ·  9Comments  ·  Source: mjmlio/mjml

I've been using mjml for a little while and I wanted to install it on my laptop. So I followed the steps on the official webpage but I got an error when I try to run it.

"bash: ./node_modules/.bin/mjml: No such file or directory"

After that I tried to run this code

export PATH="$PATH:./node_modules/.bin"

When I try to run it again using $ mjml -r index.mjml I got the following error:

mjml: command not found


My node version is v7.8.0 Also, my nodejs version is v6.10.2


I'll appreciate any comment and help, thank you.

Discussion

Most helpful comment

Do cat ~/.bash_profile you tried to execute it here :)

You should remove your node_modules & package.json from your home and do a directory like mjml_workspace then you can redo npm init -y and npm install mjml and then you can use MJML with ./node_modules/.bin/mjml

All 9 comments

@terepaima

  • I'm assuming you're on a Mac
  • Let's see the contents of your ~/.bash_profile
  • What's your terminal output when you fire a which node command?

@terepaima, you can also try to run npm init (press Enter to every prompt) before running npm install mjml.

You can do npm init -y to avoid the prompt. You should create a directory like mjml-workspace or something

@ fusion27

I'm using a laptop that used to have windows 10 but I change completely to Ubuntu.

The result is -bash: /home/terepaima/.bash_profile: Permission denied
I tried to run it with sudo and I got sudo: /home/terepaima/.bash_profile: command not found

With which node here's what I got:

Command 'which' is available in the following places

  • /bin/which
  • /usr/bin/which
    The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable.
    which: command not found

I run npm init then npm install mjml, here's the result

[email protected] /home/terepaima
└── [email protected]

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"ia32"})
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

When I try tu run mjml I still got the same error :(


Thanks all for your help :)

Do cat ~/.bash_profile you tried to execute it here :)

You should remove your node_modules & package.json from your home and do a directory like mjml_workspace then you can redo npm init -y and npm install mjml and then you can use MJML with ./node_modules/.bin/mjml

@terepaima - love me some Linux, good form 🐧

  • Ubuntu uses ~/.bashrc for bash customizations, try taking a look there.
  • Try /usr/bin/which node

Thanks @iRyusa, I tried what you said and now I'm able to use ./node_modules/.bin/mjml index.mjml Inside my mjml_workspace folder. I tried to use export PATH='$PATH:./node_modules/.bin' to only use a mjml command but I still got the same error.

For know I'm fine with the results, I only need to use it with ./node_modules/.bin/mjml index.mjml

I'm closing this one then !

If you've got trouble with local install you can still use global install at your own risk !
:+1:

I got same error on my windows so i tried installing it globally using the command npm -g install mjml and everything works fine, no need to run npm init in the project directory unless you're using it for something else

Was this page helpful?
0 / 5 - 0 ratings