-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug-Candidate]: The system cannot find the file specified - that exists #1426
Comments
Hi @majorisgit, thanks for the report! I see the error is occurring when executing Traceback (most recent call last):
File "C:\Users\user001\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 370, in get_version
with subprocess.Popen(
File "C:\Users\user001\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\user001\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified I'd suggest installing pip3 install solc-select
solc-select use 0.8.17 --always-install
slither Small_TestContract.sol |
I tried them, now it works on command line. But VS code extension is still failing. Command line - D:\project>slither contract/Small_TestContract.sol Pragma version>=0.8.0<0.9.0 (contract/Small_TestContract.sol#3) is too complex Contract smallTestContract (contract/Small_TestContract.sol#5-23) is not in CapWords D:\project> VS code extension - Slither: Solidity static analysis framework by Trail of Bits Analysis: 0 succeeded, 1 failed, 0 skipped |
Note that you are testing different things, the first one (command line) is running slither against a single file, while the latter (extension) is analyzing a folder. Going by the error message in the second case, it looks like the folder does not contain a project using a supported framework (eg hardhat), nor solidity (.sol) files in it. Slither will not look for files recursively in other directories in this "plain solc with a folder" mode, so that's why you get this error. |
Thank you. That was correct, I placed one .sol file in the root folder for test and the extension worked. |
I'm not too familiar with the vscode extension, but I see there's an issue open for it requesting the feature, so it might not be possible right now: crytic/contract-explorer#23 If you can use a compilation framework for your project (eg hardhat, foundry, etc) so that building with the framework from the root folder works, that could be a way to get it working in the meantime, as slither will not be looking for files but running the framework build instead. Another option could be looking into running slither manually with the |
Describe the issue:
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified
File clearly exists.
I tried command line and VS code addon. Both fail with same error.
Code example to reproduce the issue:
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
contract smallTestContract{
address public contractOwner;
address public contractAddress = address(this);
}
Version:
D:\project\contract>slither --version
0.9.0
Relevant log output:
The text was updated successfully, but these errors were encountered: