Run js with Python Subprocess

I am trying to run a javascript file on replit with Python subprocess module but I keep getting errors. I am sharing my code and error below. I would appreciate if you can help me.
Repl link:

import subprocess

result =["node", "files/760426163369017375.js"],


Code Error:

CompletedProcess(args=['node', 'files/760426163369017375.js'], returncode=1, stdout='', stderr="node: /lib/x86_64-linux-gnu/ version `GLIBC_2.33' not found (required by /nix/store/ia1nj04xx5v5rbg349m6dpicl1j11cwi-cpplibs/lib/\nnode: /lib/x86_64-linux-gnu/ version `GLIBC_2.32' not found (required by /nix/store/ia1nj04xx5v5rbg349m6dpicl1j11cwi-cpplibs/lib/\nnode: /lib/x86_64-linux-gnu/ version `GLIBC_2.36' not found (required by /nix/store/ia1nj04xx5v5rbg349m6dpicl1j11cwi-cpplibs/lib/\nnode: /lib/x86_64-linux-gnu/ version `GLIBC_2.34' not found (required by /nix/store/ia1nj04xx5v5rbg349m6dpicl1j11cwi-cpplibs/lib/\n")

Hello @sferhat5888!
That is not an error, it shows what has been outputted. You can get the output by printing result.stdout and result.stderr, where STDOUT is console.log statements and stderr is the errors.

By printing result.stderr, you will get GLIBC_2 was not found. Check out this topic for help.


If you look at the output I gave, the stdout section looks empty. The content of my js file only says “console.log(5)”. When I examine the topic you gave, I see that the general solution is “Remove pkgs.glibc from replit.nix and then set disableGuessImports = true in .replit” but I don’t have such a section in my replit.nix file

Could you try moving your code to a new Repl? That should fix your issue.

Yes of course but not fixed

The .replit and replit.nix files are different.

1 Like