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? – Richard Horrocks Dec 2 '19 at 23:24
  • Hi! Thanks for replying.In package.json file i have solc in dependencies even though i am getting this error – Arun Karthick Dec 3 '19 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/… – Richard Horrocks Dec 3 '19 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 solc@0.4.17".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. – Arun Karthick Dec 3 '19 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. – Richard Horrocks Dec 3 '19 at 12:38

Had the same issue .

  1. npm uninstall solc
  2. npm install --save solc@0.4.25
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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