1

Using windows 11 and VS Code.

I installed circom and snarkjs:

npm install -g circom

and

npm install -g snarkjs

which seemed to install fine.

I also installed the extention:

circom-highlighting-vscode v0.0.2

Now when I run the command:

circom InRange.circom -o InRange.json

I get the error:

bash: circom: command not found

I also installed this path in system variables:

C:\Users\someUser\AppData\Roaming\npm\node_modules\circom\node_modules.bin

and I get a similar error with snarkjs:

snarkjs setup setup -c InRange.json

bash: snarkjs: command not found

I figure if I can solve the first one, then the second one will be solved.

I have been troubleshooting this for hours with no success. Can someone recommend a solution?

Thanks.

spacedog
  • 446
  • 3
  • 13

1 Answers1

0

It seems like the circom and snarkjs commands are not being recognized by your terminal. Here are a few things you could try:

  1. Check if the installation was successful: Verify if circom and snarkjs were successfully installed by running the following commands:

    npm list -g | grep circom
    npm list -g | grep snarkjs
    

    This should display the version numbers of circom and snarkjs if they are installed globally. If not, try reinstalling them.

  2. Check your system's PATH: The PATH variable is used by the terminal to find executable files. Make sure that the directory where circom and snarkjs are installed is included in your system's PATH. To do this, open the terminal and run:

    echo $PATH
    

    This should display a list of directories separated by colons. Check if the directory where circom and snarkjs are installed is included in this list. If not, add it to the PATH variable. You can add it temporarily by running:

    export PATH=$PATH:/path/to/circom:/path/to/snarkjs
    

    Replace /path/to/circom and /path/to/snarkjs with the actual paths where circom and snarkjs are installed. If this works, you can make the change permanent by adding it to your shell's startup script.

  3. Try running the commands with npx: If circom and snarkjs are installed locally in your project directory, you can try running the commands with npx instead of directly. For example:

    npx circom InRange.circom -o InRange.json
    npx snarkjs setup setup -c InRange.json
    

    This will use the locally installed versions of circom and snarkjs.

Hope this helps! Let me know if you have any other questions.

Pavel Fedotov
  • 748
  • 1
  • 7
  • 29
  • Thanks @Pavel for the detailed response. Yes the first commands returned the version numbers, both have paths, and neither work when using commands like "snarkjs --help". This is the path for snark: "C:\Users\SomeUser\AppData\Roaming\npm\node_modules\snarkjs\node_modules\.bin". What else can I try? – spacedog May 04 '23 at 15:00
  • In that case, you could try uninstalling and then reinstalling circom and snarkjs globally with the following commands: `npm uninstall -g circom` `npm uninstall -g snarkjs` `npm install -g circom` `npm install -g snarkjs` After that, check if the commands are being recognized by running `circom --version` and `snarkjs --version`. If these commands work, you should be able to use other snarkjs commands as well. – Pavel Fedotov May 04 '23 at 16:49
  • Nothing is working. "bash: snarkjs: command not found. Is this God's punishment for not being a Mac user? – spacedog May 04 '23 at 17:10
  • No need to worry, being a non-Mac user is not God's punishment. We can troubleshoot the issue further. Since the paths for circom and snarkjs were not recognized earlier, it's possible that the npm global bin directory is not in your system's PATH environment variable. You can check by running the following command: echo $PATH If you don't see the path to the npm global bin directory in the output, you can try adding it manually by running the following command: export PATH=$PATH:/Users/SomeUser/npm-global/bin – Pavel Fedotov May 04 '23 at 17:16
  • Replace "/Users/SomeUser" in the above command with the actual path to your home directory. After this, run the circom --version and snarkjs --version commands to check if they are recognized. If they work, you should be able to use other circom and snarkjs commands as well. – Pavel Fedotov May 04 '23 at 17:16
  • Yes, I run echo $PATH and both are found there: "c/Users/SomeUser/AppData/Roaming/npm/node_modules/snarkjs/node_modules/.bin", "c/Users/SomeUser/AppData/Roaming/npm/node_modules/circom/node_modules/.bin". These are real paths, but perhaps not the correct ones. Not sure what other path to look for. Saddly, I have to leave until Saturday, but will check back in the late evenings. Thank you for sticking this out with me! – spacedog May 04 '23 at 18:04