'What is wrong with my crypto price discovery bot?

I'm following Dapp Universitie's Create a PROFITABLE cryptocurrency trading bot video.

I use git and npm install but when I run npm run start in the terminal I get the following:

node index.js

internal/modules/cjs/loader.js:905
throw err;
^

Error: Cannot find module 'dotenv'
Require stack:
- C:\Users\Kazuriah...index.js
.
.
.
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
  code: 'MODULE_NOT_FOUND',

Any ideas what went wrong? I'm sure you want to look at my code but I really didn't edit anything from the GitHub link he provides in the video other then the .env file https://github.com/dappuniversity/price-bot



Solution 1:[1]

Yeah it looks like your npm install did not work as expected, and didn't install all the dependencies. I just tried cloning the repo you linked down, and was able to get all the dependencies.

The package.json lists dotenv so if it worked, it shouldn't fail.

Did you make sure to delete the package-lock.json file before you ran your npm install, because that may cause some issues if it is out of date.

Take a look at my screenshot and you can see how I went about installing it and was able to run the program, only failing because I don't have the API keys in my .env file.

Price-bot installation Windows 10 with Cmder command prompt terminal

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 treckstar