Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Bug, or clarification needed around forge install, and the lib folder #275

@positonic

Description

@positonic

I'm using forge with create-eth, and when I run forge install it installs in the lib folder in the root of my project.

I appear to be having an issue with paths though. My packages/foundry/remappings.txt file has the line:
oz-upgradeable=/lib/hypercerts/contracts/contracts/lib/openzeppelin-contracts-upgradeable/contracts/

It's throwing an error:

hyperstaker-mono git:(feat-basic-staking) ✗ yarn test                   
[⠊] Compiling...
Error: 
Failed to resolve file: "/Users/james/code/hyperstaker-mono/packages/foundry/lib/hypercerts/contracts/contracts/lib/openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol": No such file or directory (os error 2).
 Check configured remappings..
    --> "/Users/james/code/hyperstaker-mono/lib/hypercerts/contracts/contracts/HypercertMinter.sol"
        "oz-upgradeable/security/PausableUpgradeable.sol"

Which basically shows that it's looking for the lib folder relative to the foundry folder:
packages/foundry

I'm stuck on how to get around this.

I've tried:

  • passing in a flag - yarn test --lib-paths ./lib
  • adding the flag to packages/foundry/package.json ---> "test": "forge test",

The only way I have been been able to get it working is to hard code the path to the folder like this:
oz-upgradeable=/Users/me/code/hyperstaker-mono/lib/hypercerts/contracts/lib/openzeppelin-contracts-upgradeable/contracts/

This is problematic as it's a shared repo which others work on, and I'm a bit confused by this behaviour altogether, and wonder if I'm doing something wrong, or if it's a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions