'Truffle installation

[]1Please I have been trying to install truffle using cmd and I keep getting an error, I even tried using the terminal in vscode and I still got thesame error message please I need help. i tried installing truffle on my cmd using "npm install -g truffle".



Solution 1:[1]

You must install nodejs which comes with npm first.

The command you are trying to use is npm and i feel like it is not installed.

Link

Solution 2:[2]

You probably installed npm with NodeJs and truffle properly. The error is about your file don't have a file extension and VS Code can't recognize your language. You have to type npm init -y in the terminal. Then, when you type truffle init and press Enter, truffle will create the necessary dev environment for you. Open the file explorer by pressing Ctrl + B and create a file named MyContract.sol in the contracts folder. You can now start writing code in Solidity. For more instructions follow this guide.

Note: Make sure you type the commands in the folder where you want to create your project.

Or you can just create a file with .sol extension like MyContract.sol and write your code in it but you need to use truffle to compile and deploy your contract.

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 mnkhod
Solution 2 Yunus YILDIRIM