traderclaw-cli 1.0.127 → 1.0.128

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.
@@ -369,6 +369,21 @@ function canUseSudoWithoutPrompt() {
369
369
  }
370
370
  }
371
371
 
372
+ /**
373
+ * NodeSource/deb npm defaults to a root-owned global tree (/usr/lib/node_modules). Non-root
374
+ * `npm install -g` must target a user prefix; `NPM_CONFIG_PREFIX` is applied to every npm child.
375
+ */
376
+ function ensureNpmUserGlobalPrefixForNonRoot() {
377
+ if (typeof process.getuid !== "function" || process.getuid() === 0) return;
378
+ const prefix = join(homedir(), ".npm-global");
379
+ try {
380
+ mkdirSync(prefix, { recursive: true });
381
+ } catch {
382
+ /* ignore */
383
+ }
384
+ process.env.NPM_CONFIG_PREFIX = prefix;
385
+ }
386
+
372
387
  /** User systemd (openclaw gateway) expects XDG_RUNTIME_DIR under /run/user/<uid> once linger is on. */
373
388
  function primeLinuxUserRuntimeEnv() {
374
389
  if (process.platform !== "linux" || typeof process.getuid !== "function") return;
@@ -599,6 +614,7 @@ function getGlobalOpenClawPackageDir() {
599
614
  */
600
615
  /** Runs `npm install` in the global `openclaw` package directory (fixes missing `grammy` etc.). */
601
616
  export async function ensureOpenClawGlobalPackageDependencies() {
617
+ ensureNpmUserGlobalPrefixForNonRoot();
602
618
  const dir = getGlobalOpenClawPackageDir();
603
619
  if (!dir) {
604
620
  return { skipped: true, reason: "global_openclaw_dir_not_found" };
@@ -2770,6 +2786,7 @@ export class InstallerStepEngine {
2770
2786
  this.state.status = "running";
2771
2787
  this.state.startedAt = nowIso();
2772
2788
  try {
2789
+ ensureNpmUserGlobalPrefixForNonRoot();
2773
2790
  if (!this.options.skipPreflight) {
2774
2791
  await this.runStep("preflight", "Checking prerequisites", async () => {
2775
2792
  if (!commandExists("node") || !commandExists("npm")) throw new Error("node and npm are required");
@@ -3190,6 +3207,8 @@ export async function runTraderClawDeepUpdate(options = {}) {
3190
3207
  onLog({ at: nowIso(), stepId, level, text: clean, urls: [] });
3191
3208
  };
3192
3209
 
3210
+ ensureNpmUserGlobalPrefixForNonRoot();
3211
+
3193
3212
  async function runDeepStep(stepId, title, handler) {
3194
3213
  onStep({ at: nowIso(), stepId, status: "in_progress", detail: title });
3195
3214
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traderclaw-cli",
3
- "version": "1.0.127",
3
+ "version": "1.0.128",
4
4
  "description": "Global TraderClaw CLI (install --wizard, setup, precheck). Installs solana-traderclaw as a dependency for OpenClaw plugin files.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  "node": ">=22"
18
18
  },
19
19
  "dependencies": {
20
- "solana-traderclaw": "^1.0.127"
20
+ "solana-traderclaw": "^1.0.128"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",