diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 4c2330cc4ca225..2cf7df436b5e9f 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1296,7 +1296,7 @@ E('ERR_REQUIRE_ESM', filename : path.basename(filename); msg += '\nrequire() of ES modules is not supported.\nrequire() of ' + - `${filename} ${parentPath ? `from ${parentPath} ` : ''}` + + `${filename} from ${parentPath} ` + 'is an ES module file as it is a .js file whose nearest parent ' + 'package.json contains "type": "module" which defines all .js ' + 'files in that package scope as ES modules.\nInstead rename ' +