[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
root@ /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