0

I need to set environmental variable for the babel-cli, i know the path however I could not set up. here is the path:

~/.config/yarn/global/node_modules/babel-cli/bin

inside this folder there are 4 files. i need to run babel.js via babel command.

export babel=~/.config/yarn/global/node_modules/babel-cli/bin/babel

this is the first thing i considered. then i slightly changed the path. for example, I replaced ~ with home, i omitted . from .config, i appended js to babel, babel.js, and more but I could not get it done.

I installed babel-cli locally yet I got same error:

 bash: babel: command not found 

1 Answer 1

1

According to the yarn global documentation, you should add a special bin folder to $PATH:

export PATH="$(yarn global bin):$PATH"

If you add this statement to the appropriate initialization file (like ~/.profile or ~/.bashrc or whatever), you’ll be able to use globally installed packages’ commands from anywhere without further configuration.

3
  • I run this code: yarn global bin and i got this: /home/yilmaz/.yarn/bin, then I added this: export babel="/home/yilmaz/.yarn/bin:babel" to the .bashrc file but it is not set. what am i doing wrong?
    – Yilmaz
    Commented Jul 11, 2019 at 12:25
  • Don’t run anything. Add the exact line I wrote above. Otherwise you will break stuff. Also, for the changes to take effect, you need to re-open the shell.
    – Daniel B
    Commented Jul 11, 2019 at 12:34
  • you the man. i hope anything u touch turns to bitcoin for u
    – Yilmaz
    Commented Jul 11, 2019 at 12:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .