I was trying with a simple contract,when I do "node compile.js" in my windows cmd it throws an error.I was using vscode it showing error in const solc = require('solc'),I installed everything perfectly but I don't know why the error occurs.
2 Answers
At the moment, Solidity version 0.4.17 is what im using. If you are getting this error, then you might likely have installed an unsupported version of solc.
You will need to do the following within the root of your project directory:
npm uninstall solc
rm -r node_modules
rm package-lock.json
npm install
npm install solc@0.4.17
solc
in your project? What are the contents of yourpackage.json
file?solc
?require()
searches the modules installed in the project directory'snode_modules
folder, so this error is basically saying it's not there. Did you donpm install solc
? I'd suggest just working at getting the examples from the NPM page working as a start -> npmjs.com/package/…0.4.17
is now 2 years old - you should think about using at least version0.5.0
and above as there were various important changes.