[SOLVED] Error: Cannot find module 'dotenv'

Hello I am following along on the video for the mutant NFTs: https://moralis.io/moralis-magazine-11-halloween-special-edition-moralis-mutants/

When I get to the section to run “node index.js” I get the error Error: Cannot find module ‘dotenv’

I have done the npm install and also npm install dotenv.

MacBook-Pro:~ root# npm ls
[email protected] /private/var/root
±- [email protected]
`-- [email protected]

Running on macOS Monterey 12.2

It helps to delete the entire node modules and yarn.lock or package-lock.json and do yarn install again

Perhaps there was a dependency issue

Thank you for the response. Yes, it was a dependancy. I am now looking for the following dependacy. I installed the ethers package.

Error: Cannot find module ‘@ethersproject/contracts’

Usually, by installing ethers, you should get all the other dependencies as well. Make sure to install using yarn.

Thank you for the response. Yes, it was a dependancy. I am now looking for the following dependacy. I installed the ethers package.

Error: Cannot find module ‘@ethersproject/contracts’

Thanks. I installed yarn and homebrew and was able to resolve it.

1 Like