Traceback Error after running "slither contracts/File.sol " command
traceback error, After runnig the "slither contracts/File.sol" command as specified in the repo. please what should i do ?
Traceback (most recent call last):
File "C:\Users\\AppData\Roaming\Python\Python39\site-packages\crytic_compile\platform\solc.py", line 243, in get_version
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
File "C:\Users\\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\OCHAI DAVID\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\slither\__main__.py", line 712, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\slither\__main__.py", line 71, in process_all
compilations = compile_all(target, **vars(args))
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\crytic_compile.py", line 1076, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\OCHAI DAVID\AppData\Roaming\Python\Python39\site-packages\crytic_compile\crytic_compile.py", line 137, in __init__
self._compile(**kwargs)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\crytic_compile.py", line 987, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\platform\solc.py", line 144, in compile
targets_json = _run_solc(
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\platform\solc.py", line 303, in _run_solc
compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\platform\solc.py", line 246, in get_version
raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified
ERROR:root:None
ERROR:root:Error in ufragments.sol
ERROR:root:Traceback (most recent call last):
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\platform\solc.py", line 243, in get_version
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
File "C:\UsersAppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\slither\__main__.py", line 712, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\slither\__main__.py", line 71, in process_all
compilations = compile_all(target, **vars(args))
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\crytic_compile.py", line 1076, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\crytic_compile.py", line 137, in __init__
self._compile(**kwargs)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\crytic_compile.py", line 987, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\platform\solc.py", line 144, in compile
targets_json = _run_solc(
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\platform\solc.py", line 303, in _run_solc
compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\crytic_compile\platform\solc.py", line 246, in get_version
raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified
I am facing a similar issue, if not the same. It worked at some point for me, but then I migrated from Truffle to Hardhat and upgraded Python to 3.9 and now, for the love of me, I can't run it anymore.
In fact, here is what I get when I try to run slither with the VSCode extension (the one from Trail of Bits). I get this whether I specify the compiler path or not.
⸻ Analysis: 0 succeeded, 1 failed, 0 skipped ⸻
Refreshing explorer...
Loaded 0 issues, displaying 0
⸻ Starting analysis ⸻
Error: Error in workspace "c:\Users\me\Documents\Projects\Blockchain\Project1":
Traceback (most recent call last):
File "c:\users\me\appdata\local\programs\python\python39\lib\site-packages\slither\__main__.py", line 721, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "c:\users\me\appdata\local\programs\python\python39\lib\site-packages\slither\__main__.py", line 71, in process_all
compilations = compile_all(target, **vars(args))
File "c:\users\me\appdata\local\programs\python\python39\lib\site-packages\crytic_compile\crytic_compile.py", line 1076, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "c:\users\me\appdata\local\programs\python\python39\lib\site-packages\crytic_compile\crytic_compile.py", line 137, in __init__
self._compile(**kwargs)
File "c:\users\me\appdata\local\programs\python\python39\lib\site-packages\crytic_compile\crytic_compile.py", line 987, in _compile
self._platform.compile(self, **kwargs)
File "c:\users\me\appdata\local\programs\python\python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 68, in compile
process = subprocess.Popen(
File "c:\users\me\appdata\local\programs\python\python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "c:\users\me\appdata\local\programs\python\python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
⸻ Analysis: 0 succeeded, 1 failed, 0 skipped ⸻
Refreshing explorer...
Loaded 0 issues, displaying 0
Sorry for bumping (after 2 years lol), but this happened to me too, the error message is almost exactly the same (except for the locations). I'm using Hardhat and Python 3.9, plz fix
Traceback (most recent call last):
File "c:\users\dev\appdata\local\programs\python\python39\lib\site-packages\slither\__main__.py", line 723, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "c:\users\dev\appdata\local\programs\python\python39\lib\site-packages\slither\__main__.py", line 71, in process_all
compilations = compile_all(target, **vars(args))
File "c:\users\dev\appdata\local\programs\python\python39\lib\site-packages\crytic_compile\crytic_compile.py", line 489, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "c:\users\dev\appdata\local\programs\python\python39\lib\site-packages\crytic_compile\crytic_compile.py", line 109, in __init__
self._compile(**kwargs)
File "c:\users\dev\appdata\local\programs\python\python39\lib\site-packages\crytic_compile\crytic_compile.py", line 417, in _compile
self._platform.compile(self, **kwargs)
File "c:\users\dev\appdata\local\programs\python\python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 66, in compile
with subprocess.Popen(
File "c:\users\dev\appdata\local\programs\python\python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "c:\users\dev\appdata\local\programs\python\python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified```
I'm getting the same issue, someone have fixed?
Same issue here, any suggestions? Currently running python3.9 which could be an issue
same issue
same issue
Joining the party, same issue! Double checked all my microsoft SDK & local env variables, nothing wrong.
Same problem here
If you add parameter --ignore-compile then pass. But it is not workaround i think.
ı have same problem here
I had the same problem. In order to temporarily circumvent this issue, I used Windows Subsystem for Linux (WSL). Specifically, the Ubuntu distribution. My setup is a Hardhat project. I did the following:
Install Slither:
sudo apt update && sudo apt upgrade
sudo apt install python3.8
pip3 install slither-analyzer
To check the Python version, run:
python3 -V
Install nodejs (v16.x):
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt install -y nodejs
To check the nodejs version, run:
node -v
Install the npm dependencies of the project:
npm i
Run Slither 🎉:
slither .
Same issue.
Same issue.
Ive found the solution that worked for me. Run the following:
- pip install solc-select (For windows: pip install solc-select==1.0.0b1)
- solc-select install 0.8.10
- solc-select use 0.8.10
Then youre good. Make sure youre running slither in the root folder of your project like so:
C:\Users\Username\MyProject> slither contracts/RaidersNFT.sol
Hi everyone! Slither 0.8.3 and crytic-compile 0.2.3 have now been released and should resolve this problem on Windows. I'll close this issue, but feel free to create a new one if you still experience problems after upgrading both slither and crytic-compile to the latest releases.
NB: If you are using solc-select, remember to install the beta version for Windows support (pip install solc-select==1.0.0b1)
Confirmed - I upgraded slither and crytic-compile to the latest versions on Windows (recommend first to remove slither and crytic-compile from the system in order to have a clean latest version) and everything worked smoothly. Thanks for fixing this!
Still facing the issue with the latest version v0.8.3. Please help, there is no clear resolution for this.
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/__main__.py", line 755, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/__main__.py", line 87, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/__main__.py", line 70, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/slither.py", line 95, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/solc_parsing/slither_compilation_unit_solc.py", line 211, in parse_top_level_from_loaded_json
contract.set_offset(top_level_data["src"], self._compilation_unit)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/core/source_mapping/source_mapping.py", line 124, in set_offset
self._source_mapping = self._convert_source_mapping(offset, compilation_unit)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/core/source_mapping/source_mapping.py", line 101, in _convert_source_mapping
(lines, starting_column, ending_column) = self._compute_line(
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/core/source_mapping/source_mapping.py", line 43, in _compute_line
end_line, ending_column = compilation_unit.core.crytic_compile.get_line_from_offset(
File "/Users/yohan/Library/Python/3.8/lib/python/site-packages/crytic_compile/crytic_compile.py", line 291, in get_line_from_offset
return lines_delimiters[offset]
KeyError: 566
None
Error in .
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/__main__.py", line 755, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/__main__.py", line 87, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/__main__.py", line 70, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/slither.py", line 95, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/solc_parsing/slither_compilation_unit_solc.py", line 211, in parse_top_level_from_loaded_json
contract.set_offset(top_level_data["src"], self._compilation_unit)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/core/source_mapping/source_mapping.py", line 124, in set_offset
self._source_mapping = self._convert_source_mapping(offset, compilation_unit)
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/core/source_mapping/source_mapping.py", line 101, in _convert_source_mapping
(lines, starting_column, ending_column) = self._compute_line(
File "/Library/Python/3.8/site-packages/slither_analyzer-0.8.3-py3.8.egg/slither/core/source_mapping/source_mapping.py", line 43, in _compute_line
end_line, ending_column = compilation_unit.core.crytic_compile.get_line_from_offset(
File "/Users/yohan/Library/Python/3.8/lib/python/site-packages/crytic_compile/crytic_compile.py", line 291, in get_line_from_offset
return lines_delimiters[offset]
KeyError: 566
facing the same issue, Foundry project, running on Docker with ubuntu:22.04 windows host, slither version 0.9.1.
Error: Source "@openzeppelin/contracts/token/ERC20/IERC20.sol" not found: File not found.
--> src/Contract.sol:4:1:
|
4 | import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Source "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol" not found: File not found.
--> src/Contract.sol:5:1:
|
5 | import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
| ^^^^^^^^^^^^
project compiles and finishes test suite fine when running forge build/forge test
UPDATE
got this to work by ditching Foundry's remappings - instead of importing using a relative path or remappings, try setting the path to an absolute path (relative to repo root).
renistall freshh install and other methods dont work! same issus