-
Notifications
You must be signed in to change notification settings - Fork 996
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]: slither fails to run "FileNotFoundError: [WinError 2] The system cannot find the file specified" #1103
Comments
Hi @Ellahinator, thanks for your report. Can you confirm if you have a working node & hardhat setup? In particular, Slither expects the following command to work and build your project: If npx is the problem, you can try disabling it with |
hmmm hardhat seems to be working fine when I do slither --npx-disable .
'hardhat compile --force' running
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
compilations = compile_all(target, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\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
None
Error in .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
compilations = compile_all(target, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\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 |
If hardhat works fine, you can compile manually with the command from above and then invoke slither with If that works, can you please fill an issue on crytic-compile so we can track why executing hardhat fails on Windows? Slither uses crytic-compile under the hood for the project compilation. |
error when running PS C:\Users\Danny\nnppmm> npx hardhat compile --force
Compiled 2 Solidity files successfully
PS C:\Users\Danny\nnppmm> slither --hardhat-ignore-compile .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol']
None
Error in .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_jsoned_json
get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
raise ValueError( nnppmm\\contracts\\Greeter.sol
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\rdhat\\console.sol']nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol'] |
That might be related to #1065, if you are comfortable with it could you try installing that modified branch ( |
same issue PS C:\Users\Danny\nnppmm> slither --hardhat-ignore-compile .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol']
None
Error in .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol'] |
I also tried downgrading the solidity extension but that didnt do anything. |
error when trying to run specific file PS C:\Users\Danny\nnppmm> slither contracts/Greeter.sol
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 369, in get_version
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\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\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
compilations = compile_all(target, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 153, in compile
targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 275, in _get_targets_json
return _run_solc(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 471, in _run_solc
compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 380, in get_version
raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified
None
Error in contracts/Greeter.sol
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 369, in get_version
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\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\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
compilations = compile_all(target, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 153, in compile
targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 275, in _get_targets_json
return _run_solc(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 471, in _run_solc
compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\solc.py", line 380, in get_version
raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified |
uninstalled and reinstalled crytic-compile PS C:\Users\Danny\nnppmm> crytic-compile .
INFO:CryticCompile:'npx hardhat compile --force' running
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\Scripts\crytic-compile.exe\__main__.py", line 7, in <module>
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\__main__.py", line 192, in main
compilations = compile_all(**vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified |
I have a similar problem. In my own case, the build-info is in a different location (team conventions). Is there a way to configure slither to locate it? |
@Ellahinator I have been working on some more Windows fixes that might help you with your problem, would you mind testing the following crytic-compile branch? https://github.com/crytic/crytic-compile/tree/dev-windows-long-paths You can install it by running |
Hi @staa99, are you looking for something like |
Thanks @elopez. This works for me |
Successfully installed that branch. Unfortunately running into the same errors.
PS C:\Users\Danny\nnppmm> npx hardhat compile --force
Compiled 2 Solidity files successfully
PS C:\Users\Danny\nnppmm> slither .
'npx hardhat compile --force' running
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
compilations = compile_all(target, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\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
None
Error in .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 73, in process_all
compilations = compile_all(target, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\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
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224,
in parse_top_level_from_loaded_json
get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol']
None
Error in .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 84, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\__main__.py", line 67, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\slither.py", line 97, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224,
in parse_top_level_from_loaded_json
get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python39\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nnppmm\\node_modules\\hardhat\\console.sol']
PS C:\Users\Danny\nnppmm> crytic-compile .
INFO:CryticCompile:'npx hardhat compile --force' running
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\Scripts\crytic-compile.exe\__main__.py", line 7, in <module>
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\__main__.py", line 192, in main
compilations = compile_all(**vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\hardhat.py", line 72, in compile
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified |
Checking the line numbers in the error, they don't seem to match with the new branch 🤔 Can you please double check if the new crytic-compile is getting installed successfully? You may need to remove the version you have now ( |
Also, you seem to have two python versions installed (3.9 and 3.10) and from the errors you posted, some tools use one, other tools use the other. Maybe that is causing confusion as well. |
Only have one python installed now. The correct crytic-compile branch should be installed as well. crytic-compile .
INFO:CryticCompile:'npx hardhat compile --force' running
INFO:CryticCompile:Compiled 2 Solidity files successfully
slither .
'npx hardhat compile --force' running
Compiled 2 Solidity files successfully
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 84, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 67, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\slither.py", line 97, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol']None
Error in .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 743, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 84, in process_all
) = process_single(compilation, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 67, in process_single
slither = Slither(target, ast_format=ast, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\slither.py", line 97, in __init__
parser.parse_top_level_from_loaded_json(ast, path)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\solc_parsing\slither_compilation_unit_solc.py", line 224, in parse_top_level_from_loaded_json
get_imported_scope = self.compilation_unit.get_scope(import_directive.filename)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\core\compilation_unit.py", line 231, in get_scope
filename = self._crytic_compile_compilation_unit.crytic_compile.filename_lookup(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 199, in filename_lookup
raise ValueError(
ValueError: hardhat\console.sol does not exist in ['C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\node_modules\\hardhat\\console.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol', 'C:\\Users\\Danny\\nppm\\contracts\\Greeter.sol']
|
Nice to see progress! 👍 Would you mind testing with the slither I tried locally on Windows with a hardhat sample project and it appeared to work fine now, when combined with the fixed crytic-compile. If that doesn't work, is there a chance you could share your hardhat project to debug further? |
Here are the errors for a folder with only .sol files. slither .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 370, in get_version
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, 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\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 744, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 76, in process_all
compilations = compile_all(target, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 658, in compile_all
compilations.append(CryticCompile(filename, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 154, in compile
targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 276, in _get_targets_json
return _run_solc(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 474, in _run_solc
compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 385, in get_version
raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified
None
Error in .
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 370, in get_version
with subprocess.Popen(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, 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\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\slither\__main__.py", line 744, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
compilations = compile_all(target, **vars(args))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 658, in compile_all
compilations.append(CryticCompile(filename, **kwargs))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 154, in compile
targets_json = _get_targets_json(compilation_unit, self._target, **kwargs)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 276, in _get_targets_json
return _run_solc(
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 474, in _run_solc
compiler="solc", version=get_version(solc, env), optimized=is_optimized(solc_arguments)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python310\lib\site-packages\crytic_compile\platform\solc.py", line 385, in get_version
raise InvalidCompilation(error)
crytic_compile.platform.exceptions.InvalidCompilation: [WinError 2] The system cannot find the file specified crytic-compile .
ERROR:CryticCompile:[WinError 2] The system cannot find the file specified |
Awesome! that other error you are getting appears to be when launching |
I have solcjs since I am using windows. solcjs --version
0.7.6+commit.7338295f.Emscripten.clang |
Yeah, that won't work unfortunately. It expects solc to be installed. I haven't tried but if you grab and install solc.exe from the compiler releases it should work. Otherwise you can install solc-select beta which has Windows support and hopefully that other use case will work: |
It works! Thank you so much! You have been extremely helpful :D |
That's great to hear! I'm glad I could help. I'll keep this open until the changes are merged, but this should be resolved now 👍 |
Slither 0.8.3 and crytic-compile 0.2.3 have now been released 🎉 |
What happened?
I tried running
slither .
slither --solc-remaps @openzeppelin/=$(pwd)/node_modules/@openzeppelin/ .
Also tried uninstalling and reinstalling solc via npm.
Version
0.8.2
Relevant log output
The text was updated successfully, but these errors were encountered: