diff --git a/packages/cli/src.ts/solc.ts b/packages/cli/src.ts/solc.ts index e1a373cd8..5ed97697b 100644 --- a/packages/cli/src.ts/solc.ts +++ b/packages/cli/src.ts/solc.ts @@ -125,8 +125,13 @@ function _compile(_solc: any, source: string, options?: CompilerOptions): Array< // Creates a require which will first search from the current location, // and for solc will fallback onto the version included in @ethersproject/cli export function customRequire(path: string): (name: string) => any { - const pathRequire = _module.createRequireFromPath(resolve(path, "./sandbox.js")); - const libRequire = _module.createRequireFromPath(resolve(__filename)); + // Node 8.x does not support createRequireFromPath + const createRequire = (_module.createRequireFromPath || (function(path: string) { + return require + })); + + const pathRequire = createRequire(resolve(path, "./sandbox.js")); + const libRequire = createRequire(resolve(__filename)); return function(name: string): any { try {