Getting started with MetaMask extension development

I’ve tried to find advice on this but cannot see anything so thought I would ask, please direct me to the relevant place if this info already exists.

What is the “best practice” environment setup to work with the extension? Mac? Linux? Windows? Do you guys use VS Code or some other editor?

I’m looking to do some work with the extension on Windows 11, so have forked the GitHub repo, followed the guidance and got as far as installing my build of the extension in Chrome but then I get a load of errors. A friend of mine, trying to do the same thing on a Mac, doesn’t get the errors. So before I make the switch I wanted to see if there is any advice what to use.

Thank you in advance.

Damo

1 Like

Hello !

Please specify what exactly you are going to develop? Front-end application that interacts with a smart contract through the MetaMask extension?

Hi, thank you for your response.

Front end app that interacts with MetaMask is one of the things yes, but I was also trying to see if I can make changes to the actual MetaMask extension itself for some custom behaviour, if it’s even possible.

And this is what I’m struggling with, to even get it to work with yarn start where I am able to run it locally without errors.

@DamoGMR

To be honest, I’ve never worked in a windows environment, but can you provide a screenshot of the errors logs ?

Did you do yarn install just before running it?
Have you tried using the npm package manager?

Yeah sure, here is the error from the Extensions tab in Chrome

I have found references to this error in MetaMask GitHub > Issues and they go back few months without a fix. There was a workaround suggested but it doesn’t seem to work with the latest v18 of the extension, especially because the code where the workaround needs to be applied has completely changed now.

I am using nvm and using version 16.14.2 of node, I installed yarn, then run yarn setup and when that finished I did yarn start.

What do you do your development in? Mac? I’m assuming you’ve worked on the extension project, correct me if I’m wrong.

@DamoGMR

I only use macOS. In this environment, such an error does not occur, do I understand correctly?

You can try to remove locally installed libraries and change node version to 14.15.0, maybe that will help.

Yeah from my understanding this isnt an issue on macOS, I’d imagine the GitHub issues page would be full of people complaining about it. But at least you’ve answered one thing, people working on this extension tend to use a Mac so that’s helped.

I’ll keep looking into this and trying different versions of node, etc. I might have tried 14.15.0 already but can’t remember, I’ve tried a few.

Thanks for your help and time.

1 Like

Hey @DamoGMR, welcome to the MetaMask community! :fox_face:

The development team for MetaMask actually uses a variety of different environment setups. It’s based on their individual preference.

It is! Check out MetaMask Flask:

3 Likes

Thank you for that info, I did see the Flask thing but wasn’t sure if it’s what I needed. Now that I’ve read some more about it, I’m going to give it a go.

Regarding the different environments, are you aware of any of the MetaMask devs also having this issue that I and by the looks of it many others are having, with the LavaPack is not defined error. Is this even the place to discuss this kind of problem or should I be raising a GitHub issue?

I’ll pass the info directly to the team, but you can also raise a GitHub Issue if you would like :slight_smile:

2 Likes

I was going to raise an issue but it looks like there are 5 open issues about it already, going back to Mar 29 2021. I’ll link them below (I can only post issue numbers, can’t do links). The latest one says it’s happening with MetaMask v10.17.0 but I can confirm it also happens with v10.18.0

/MetaMask-extension/issues/15237
/MetaMask-extension/issues/14984
/MetaMask-extension/issues/13793
/MetaMask-extension/issues/13318
/MetaMask-extension/issues/10748

2 Likes

Quick update form me on this issue.

So the more I looked into it all the more I was convinced that trying to develop the extension on Windows was a bad idea. I cloned the code base into my Ubuntu WSL, installed NVM and followed the dev setup steps from the README and boom, it works!

Clearly there is something wrong with the whole yarn setup process on Windows, maybe its to do with the fact all the files are LF and not CRLF and something is getting messed up? I don’t know, just a wild guess.

So I’m happy to close this ticket and hopefully others might find it useful.

3 Likes

I’ll relay the message about Windows, but glad you got it to work! :tada:

2 Likes

Have you looked into MetaMask Snaps as a means of adding custom behavior to MetaMask?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.