Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no org-babel-execute function for javascript in emacs org-babel

I have added the following code to my init file. But I still get the error.

(org-babel-do-load-languages
      'org-babel-load-languages
      '((js . t)))

I noticed in Babel supported Languages, it says javascript requires node.js. So I download node.js and added the folder to my Environment PATH. However, I got the same error.

So how could I run javascript in org-babel?

like image 771
Ynjxsjmh Avatar asked Mar 18 '26 18:03

Ynjxsjmh


1 Answers

Thanks for @manandearth's link, I partly sovle this question:

Reason why I got the prompt is that I wrote the wrong src block identifier in my case.

Since I write (js . t), so it should like

#+BEGIN_SRC js
console.log("hello world");
#+END_SRC

Not

#+BEGIN_SRC javascript
console.log("hello world");
#+END_SRC

Possible identifiers can be found at https://orgmode.org/org.html#Languages and https://orgmode.org/worg/org-contrib/babel/languages.html.

like image 68
Ynjxsjmh Avatar answered Mar 21 '26 07:03

Ynjxsjmh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!