Getting back to updating my Ethereum projects, but I am getting an error when I run node compile.js
of:
Error: Cannot find module 'solc'
This is my compile.js
file:
const path = require("path");
const solc = require("solc");
const fs = require("fs-extra");
const buildPath = path.resolve(__dirname, "build");
fs.removeSync(buildPath);
const campaignPath = path.resolve(__dirname, "contracts", "Campaign.sol");
const source = fs.readFileSync(campaignPath, "utf8");
const output = solc.compile(source, 1).contracts;
fs.ensureDirSync(buildPath);
for (let contract in output) {
fs.outputJSONSync(
path.resolve(buildPath, contract + ".json"),
output[contract]
);
}
Is the above no longer a valid configuration of the compile.js
file?