enter image description hereI 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.

  • 1
    Hi there. How have you installed solc in your project? What are the contents of your package.json file? Dec 2, 2019 at 23:24
  • Hi! Thanks for replying.In package.json file i have solc in dependencies even though i am getting this error Dec 3, 2019 at 9:04
  • Okay - how have you installed solc? require() searches the modules installed in the project directory's node_modules folder, so this error is basically saying it's not there. Did you do npm install solc? I'd suggest just working at getting the examples from the NPM page working as a start -> npmjs.com/package/… Dec 3, 2019 at 9:58
  • I used Solidity compiler version 0.4.17 in my contract ,i also installed this in the project folder by "npm install --save [email protected]".Still I was not able to tackle the error,is any other method is there? And I was able to find solc folder in node_modules directory. Dec 3, 2019 at 12:00
  • Okay, in that case I'm not sure what's happening. Can you include the Node code that has the error? Note that version 0.4.17 is now 2 years old - you should think about using at least version 0.5.0 and above as there were various important changes. Dec 3, 2019 at 12:38

2 Answers 2


Had the same issue .

  1. npm uninstall solc
  2. npm install --save [email protected]

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 [email protected]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.