const path = require('path');
const solc = require('solc');
const fs = require('fs-extra');

const buildPath = path.resolve(__dirname, 'build');

const campaignPath = path.resolve(__dirname, 'contracts', 'Campaign.sol');
const source = fs.readFileSync(campaignPath, 'utf8');
const output = solc.compile(source, 1).contracts;


for(let contract in output){
        path.resolve(buildPath, contract, '.json'),

The goal is of my compiling is to create two files which are campaign.json and campaignFactory.json inside the build folder, the build folder is right inside the ethereum directory.

i keep getting error and i observed that it delete my build folder which is support to contain campaign.json and campaignFactory.json file

  • I know that this isn't the answer that you're looking for, but why not use a professional development environment like Hardhat? Jul 31 at 12:59

Your Answer

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

Browse other questions tagged or ask your own question.