SOLVED Can't init truffle

Hi! I’m very new to all of this, so I apologise if this is trivial.
I watched the tutorial on how to make a casino and I tried to follow along.
14 minutes into the video (How to Build Serverless Dapps Part 1 - Web3.js & Moralis Programming Tutorial) Filip types npm init, when I type this it works and I get a package.json inside the truffle folder
After that Filip types, truffle init which doesn’t seem to work for me and leaves me with the following error

I am located in the same folder as before (inside the truffle folder)
Any help would be greatly appreciated.

you need to install truffle globally to use truffle commands:

npm install -g truffle

The -g flag tells npm to install it globally on your computer instead of locally for the project.


Thank you that worked great. On a side note, it warned me about many outdated files in truffle. Are there any new versions and if so, how do I find them?

You can check the official website:
There you can also find how to get the latest Ganache version:

1 Like

Are you talking about the warning that says it found “X vulnerabilities of Medium severity, Y of low… etc”?

If this is the case you can do exactly what it suggests in the message:

npm audit fix

This will examine all installed npm packages and see if any of them can be updated safely to new versions. It may not fix all the problems as some updates would cause breaking changes and it tells you this.

1 Like

This worked great. Thank you very much.