Skip to content

Commit

Permalink
fix: can't load module error when app is packaged
Browse files Browse the repository at this point in the history
due to change in node.js(nodejs/node#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.
  • Loading branch information
jack-teng1 committed Jun 19, 2018
1 parent 295c823 commit 10df019
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/common/asar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 10df019

Please sign in to comment.