From b88e3be00bdb7658fdb78d78e89fc219523949af Mon Sep 17 00:00:00 2001 From: Jack Teng Date: Mon, 18 Jun 2018 16:09:11 -0700 Subject: [PATCH] fix: can't load module error when app is packaged due to change in node.js(https://github.com/nodejs/node/issues/17076) internalModuleReadFile has been renamed to internalModuleReadJSON, and in vendor/node/lib/internal/modules/cjs/loader.js it will call internalModuleReadJSON and result in can't read the package.json file. --- lib/common/asar.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/common/asar.js b/lib/common/asar.js index 1b9a993a2e67a0..20385da135967d 100644 --- a/lib/common/asar.js +++ b/lib/common/asar.js @@ -590,11 +590,11 @@ return files } - const {internalModuleReadFile} = process.binding('fs') - process.binding('fs').internalModuleReadFile = function (p) { + const {internalModuleReadJSON} = process.binding('fs') + process.binding('fs').internalModuleReadJSON = function (p) { const [isAsar, asarPath, filePath] = splitPath(p) if (!isAsar) { - return internalModuleReadFile(p) + return internalModuleReadJSON(p) } const archive = getOrCreateArchive(asarPath) if (!archive) {