@decentnetwork/beagle 0.1.84 → 0.1.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/desktop/app.js +1 -1
- package/dist/server.js +14 -2
- package/package.json +1 -1
package/dist/desktop/app.js
CHANGED
package/dist/server.js
CHANGED
|
@@ -366,7 +366,12 @@ async function globalNpmWritable() {
|
|
|
366
366
|
return { ok: true }; // nothing installed there yet
|
|
367
367
|
const { access } = await import("node:fs/promises");
|
|
368
368
|
const { constants } = await import("node:fs");
|
|
369
|
+
// BOTH, and both as directories. npm rewrites the package directory and
|
|
370
|
+
// re-links the binaries, and either one being unwritable stops the update.
|
|
371
|
+
// Checking only the scope reported "you can update" on a machine that then
|
|
372
|
+
// failed on the bin links.
|
|
369
373
|
await access(scope, constants.W_OK);
|
|
374
|
+
await access(join(prefix, "bin"), constants.W_OK);
|
|
370
375
|
return { ok: true };
|
|
371
376
|
}
|
|
372
377
|
catch {
|
|
@@ -388,10 +393,17 @@ async function globalNpmOwnershipHint(pkg) {
|
|
|
388
393
|
return `no write access to the global npm dir. \`sudo npm i -g ${pkg}@latest\` would work but leaves it root-owned, so the next update fails the same way — fix the ownership once instead.`;
|
|
389
394
|
}
|
|
390
395
|
const scope = join(prefix, "lib", "node_modules", "@decentnetwork");
|
|
391
|
-
const
|
|
396
|
+
const bin = join(prefix, "bin");
|
|
397
|
+
// Both DIRECTORIES, not the files inside them. Replacing a package directory
|
|
398
|
+
// or a bin symlink is a rename, and rename needs write permission on the
|
|
399
|
+
// CONTAINING directory — naming the symlinks themselves does nothing when
|
|
400
|
+
// their parent is root-owned. An earlier version of this hint listed
|
|
401
|
+
// bin/agentnet and bin/beagle and left people exactly as stuck, one error
|
|
402
|
+
// further along: the scope chown succeeded and npm then failed on the bin
|
|
403
|
+
// links instead.
|
|
392
404
|
return (`no write access to ${scope}. This is what a first install with sudo leaves behind, and ` +
|
|
393
405
|
`\`sudo npm i -g\` would rebuild it — run this ONCE and updates never need sudo again: ` +
|
|
394
|
-
`sudo chown -R $(id -u):$(id -g) ${scope} ${
|
|
406
|
+
`sudo chown -R $(id -u):$(id -g) ${scope} && sudo chgrp -R admin ${bin} && sudo chmod -R g+w ${bin}`);
|
|
395
407
|
}
|
|
396
408
|
/** `npm prefix -g`, or undefined if npm cannot be reached. */
|
|
397
409
|
async function npmGlobalPrefix() {
|
package/package.json
CHANGED