Rarable Clone Part6 - truffle migrate fail wth error

After setup truffle.config.js, 2_token_migration.js and MorarableToken.sol, I tried to run truffle migrate but it failed with an error.

Is there a bad version of Node.js?

Error parsing /Users/mbp/NFT/moralis-rarible/contracts/contracts/Migrations.sol: Cannot read property ‘addFunction’ of undefined


version: "^0.8.0"


const MorarableToken = artifacts.require("MorarableToken");

module.exports = function (deployer) {


pragma solidity ^0.8.0;

import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "../node_modules/@openzeppelin/contracts/utils/Counters.sol";

contract MorarableToken is ERC721 {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor() ERC721("MorarableToken", "MORA") {}

    struct Item {
        uint256 id;
        address creator;
        string uri;

    mapping(uint256 => Item) public Items;

    function createItem(string memory uri) public returns (uint256) {
        uint256 newItemId = _tokenIds.current();
        _safeMint(msg.sender, newItemId);

        Items[newItemId] = Item(newItemId, msg.sender, uri);

        return newItemId;

    function tokenURI(uint256 tokenId)
        returns (string memory)
            "ERC721Metadata: URI query for nonexistent token"

        return Items[tokenId].uri;
1 Like

I executed npm i @openzeppelin/contracts on the rarible-clone/contracts.
It’s right, I guess.

I changed Node v12.18.4 and npm i @openzeppelin/contracts , but the error message was same.

It Solved!

nodebrew use stable

npm install -g truffle

truffle version

truffle init

And then, truffle migrate has worked well.

And also, I should have killed the virtual environmental of conda.(Because I used conda for previous part.)
conda deactivated

1 Like

Hi @classlacia,

That’s great. Keep up the enthusiasm! It’s really infectious! :slight_smile:

i have a similar problem right now, gonna create a new post