# Solc --devdoc --userdoc generator does not work with @openzeppelin imports

**URL:** <https://forum.openzeppelin.com/t/solc-devdoc-userdoc-generator-does-not-work-with-openzeppelin-imports/1706>\
**Category:** SDK\
**Created:** [November 5, 2019, 9:02am UTC](https://forum.openzeppelin.com/t/solc-devdoc-userdoc-generator-does-not-work-with-openzeppelin-imports/1706 "2019-11-05T09:02:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitpusha](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/gitpusha/32/1480_2.png) [@gitpusha](https://forum.openzeppelin.com/u/gitpusha)\
**Post date:** [November 5, 2019, 9:02am UTC](https://forum.openzeppelin.com/t/solc-devdoc-userdoc-generator-does-not-work-with-openzeppelin-imports/1706/1 "2019-11-05T09:02:42Z")

</div>

Hi,  
I just installed `solc` with `homebrew` on `macOS Catalina` because I want to make use of the [Documentation Output generator](https://solidity.readthedocs.io/en/latest/natspec-format.html#documentation-output) `solc --userdoc --devdoc` . (And because I was to lazy to get openzeppelin’s `solidity-docgen` working. The command seems to be broken/unlinked:  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/f/f01884b11849d0ffc001639eeebbbb721318727e.png)

Back to the `solc` problem:  
However, `solc` seems to have problems with the `@openzeppelin` `import statements`.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/2/26a34b1f183e5abb0deaa588ad14876bb1d02760.png)

`not found: File not found`: Does anybody have any quick fixes on how `solc` can find those `@openzeppelin/` files?

Best,

Luis

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [November 6, 2019, 6:38am UTC](https://forum.openzeppelin.com/t/solc-devdoc-userdoc-generator-does-not-work-with-openzeppelin-imports/1706/2 "2019-11-06T06:38:01Z")

</div>

Hi @gitpusha,

My suggestion would be to use `solidity-docgen`. 😄

I haven’t used `solc` direct, so hopefully someone in the community can advise.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [November 7, 2019, 6:52am UTC](https://forum.openzeppelin.com/t/solc-devdoc-userdoc-generator-does-not-work-with-openzeppelin-imports/1706/3 "2019-11-07T06:52:10Z")

</div>

Hi @gitpusha,

Were you able to find how to use `@openzeppelin` with `solc`?  
I tried remappings but haven’t got the syntax correct.

* * *

To generate a document with `solidity-docgen` you can do the following:  
Install:

```auto
npm install solidity-docgen 

```

Run (using contracts in the contracts directory):

```auto
npx solidity-docgen --solc-settings "{remappings: ['@openzeppelin/contracts-ethereum-package=$PWD/node_modules/@openzeppelin/contracts-ethereum-package','@openzeppelin/upgrades=$PWD/node_modules/@openzeppelin/upgrades']}"

```

Sample token:

## Token.sol

```auto
pragma solidity ^0.5.0;

import "@openzeppelin/upgrades/contracts/Initializable.sol";

import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Detailed.sol";

/**
 * @title SimpleToken
 * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
 * Note they can later distribute these tokens as they wish using `transfer` and other
 * `ERC20` functions.
 */
contract Token is Initializable, ERC20, ERC20Detailed {

    /**
     * @dev initialize that gives msg.sender all of existing tokens.
     */
    function initialize(address sender) public initializer {
        ERC20Detailed.initialize("Token", "TKN", 18);
        _mint(sender, 1000000 * (10 ** uint256(decimals())));
    }
}

```

---

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [November 11, 2019, 3:04pm UTC](https://forum.openzeppelin.com/t/solc-devdoc-userdoc-generator-does-not-work-with-openzeppelin-imports/1706/4 "2019-11-11T15:04:19Z")

</div>

Hey there! I understand that `solidity-docgen` is a bit hard to use right now due to lack of documentation, but I’m willing to help you get it set up and customized. It fixes many shortcomings of solc’s native natspec support and gives you a lot of flexibility to achieve whatever kind of documentation you want. The output is completely customizable using [Handlebars templates](https://github.com/OpenZeppelin/solidity-docgen/blob/master/contract.hbs).

@abcoathup’s instructions should get you started. If you want to do any sort of customization of the output, let me know and I’ll guide you through it.

The only thing I’d add to @abcoathup is that it’s possible to use a shorter command since all of our packages share the `@openzeppelin` prefix:

```auto
npx solidity-docgen --solc-settings "{remappings: ['@openzeppelin=$PWD/node_modules/@openzeppelin']}"

```

This is now [in the readme](https://github.com/OpenZeppelin/solidity-docgen/blob/master/README.md#contracts-with-dependendencies).

---

<div class="post-metadata">

**Author:** ![gitpusha](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/gitpusha/32/1480_2.png) [@gitpusha](https://forum.openzeppelin.com/u/gitpusha)\
**Post date:** [November 14, 2019, 11:30am UTC](https://forum.openzeppelin.com/t/solc-devdoc-userdoc-generator-does-not-work-with-openzeppelin-imports/1706/5 "2019-11-14T11:30:32Z")

</div>

Thank you very much for stepping in and helping out. I will revisit this topic soon, and report back to you.

---

<div class="post-metadata">

**Author:** ![ccolorado](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ccolorado/32/670_2.png) [@ccolorado](https://forum.openzeppelin.com/u/ccolorado)\
**Post date:** [March 19, 2020, 6:56pm UTC](https://forum.openzeppelin.com/t/solc-devdoc-userdoc-generator-does-not-work-with-openzeppelin-imports/1706/6 "2020-03-19T18:56:28Z")

</div>

Added this to my package.json’s `scripts {}` object so all I need to do is `npm run docs`

“doc”: “npx solidity-docgen --solc-settings “{remappings: [’@openzeppelin=$PWD/node\_modules/@openzeppelin’]}””

---

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [March 26, 2020, 6:43pm UTC](https://forum.openzeppelin.com/t/solc-devdoc-userdoc-generator-does-not-work-with-openzeppelin-imports/1706/7 "2020-03-26T18:43:04Z")

</div>

Hi everyone. The latest `solidity-docgen` includes out of the box support for dependencies. I haven’t tested it extensively myself so please give it a shot and let me know how it goes.
