Skip to content

Commit 60c7219

Browse files
Update: strip a BOM before parsing package.json
1 parent b745dd9 commit 60c7219

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎darknode.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ function nexusUpdate(opts) {
873873
if (pull.status !== 0) { L.push("update failed: " + (((pull.stderr || "") + (pull.error ? pull.error.message : "")).trim() || "git pull error")); return L.join("\n"); }
874874
const changed = (run("git", ["diff", "--name-only", local, "HEAD"]).stdout) || "";
875875
if (/package(-lock)?\.json/.test(changed) && hasBin("npm")) { const ni = cp.spawnSync("npm", ["install", "--silent", "--no-audit", "--no-fund", "--no-package-lock"], { cwd: dir, encoding: "utf8", timeout: 600000 }); if (ni.status !== 0) L.push("note: npm install after update reported an issue — run `npm install` in " + dir); }
876-
let newV = VERSION; try { newV = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8")).version || newV; } catch (_) {}
876+
let newV = VERSION; try { newV = JSON.parse(stripBom(fs.readFileSync(path.join(dir, "package.json"), "utf8"))).version || newV; } catch (_) {}
877877
L.push(green("updated") + " v" + VERSION + " → v" + newV + " — restart Nexus (" + cyan("/exit") + ", then " + cyan("darknode nexus") + ") to load it.");
878878
return L.join("\n");
879879
}

0 commit comments

Comments
 (0)