mario-eth / soldeer

Solidity Package Manager written in rust
MIT License
240 stars 26 forks source link

ERROR foundry_compilers::artifacts #149

Closed DamirS09 closed 2 months ago

DamirS09 commented 3 months ago

Problem Description When running forge test, the following error occurs with file resolution:

2024-08-19T07:06:53.863980Z ERROR foundry_compilers::artifacts: error="C:/Users/user/Desktop/project/dependencies/solady-latest/test/utils/forge-std\console2.sol": The system cannot find the file specified. (os error 2)
Error: 
failed to resolve file: "C:/Users/user/Desktop/project/dependencies/solady-latest/test/utils/forge-std\console2.sol": The system cannot find the file specified. (os error 2); check configured remappings
        --> C:/Users/user/Desktop/project/script\Project.s.sol
        forge-std/console2.sol

image

remappings.txt

@solmate-latest=dependencies/solmate-latest/src/
@v4-periphery-latest=dependencies/v4-periphery-latest/src/
@v4-core-latest=dependencies/v4-core-latest/src/
@solady-latest=dependencies/solady-latest/src/
@forge-std-latest=dependencies/forge-std-latest/src/

foundry.toml

[profile.dependencies]
solmate = { version = "latest", git = "https://github.com/transmissions11/solmate.git", rev = "97bdb2003b70382996a79a406813f76417b1cf90" }
v4-periphery = { version = "latest", git = "https://github.com/Uniswap/v4-periphery.git", rev = "f2f68ecf37b6b881adc74aec11bde24f22b82afb" }
v4-core = { version = "latest", git = "https://github.com/Uniswap/v4-core.git", rev = "3609d8196a87c8107a55da8f40ecaf88d7323b05" }
solady = { version = "latest", git = "https://github.com/Vectorized/solady.git", rev = "2b58ba62398cf36545efaf6ead9ba72c8f115ff5" }
forge-std = { version = "latest", git = "https://github.com/foundry-rs/forge-std.git", rev = "bf6606142994b1e47e2882ce0cd477c020d77623" }

How to install: soldeer install forge-std~latest https://github.com/foundry-rs/forge-std.git

Additional Information Forge Version: forge 0.2.0 (1ddea96f 2024-05-20T10:22:21.490868500Z) Solidity Version: solc = "0.8.26" Operating System: Windows

mario-eth commented 3 months ago

can you paste import content of C:/Users/user/Desktop/project/script\Project.s.sol ?

DamirS09 commented 3 months ago

can you paste import content of C:/Users/user/Desktop/project/script\Project.s.sol ?

import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol";

import {Script} from "forge-std/Script.sol"; import {console2} from "forge-std/console2.sol";

import {SimpleProject} from "./../src/SimpleProject.sol"; import {Test} from "./../test/utils/Test.sol"; import {HelperConfig} from "./HelperConfig.sol";

mario-eth commented 3 months ago

you should have :

import {Script} from "@forge-std-latest/Script.sol";
import {console2} from "@forge-std-latest/console2.sol";

Because @forge-std-latest in your remappings says that it should point to the dependency

DamirS09 commented 3 months ago

you should have :

import {Script} from "@forge-std-latest/Script.sol";
import {console2} from "@forge-std-latest/console2.sol";

Because @forge-std-latest in your remappings says that it should point to the dependency

Thanks for the answer, I also ran into a problem in the dependencies folder that files in lib are not loaded. I have to go to cd/dependencies/v4-core-latest/ and call the forge build command, but there is still an error in the imports.

image

also, if I call theforge test or forge build command, an error appears:

"C:/Users/user/Desktop/project/dependencies/solmate-latest/src\src/auth/Owned.sol": The system cannot find the specified path. (os error 3); check configured remappings
        --> C:/Users/user/Desktop/project/dependencies/v4-core-latest/src/ProtocolFees.sol
        solmate/src/auth/Owned.sol

image

image

mario-eth commented 3 months ago

Hey, in version 0.3.0 which should be deployed soon, waiting for Foundry team to review, we will retrieve the dependency dependencies as well. https://github.com/foundry-rs/foundry/pull/8648 You can track it here to see when it will be installed, meanwhile you have to go and pull the dependencies manually inside the dependencies

mario-eth commented 2 months ago

This has been merged, 0.3.0 is live feel free to do foundryup