Skip to content

fix: use npm replace npx when installing package#1335

Merged
syzsunshine219 merged 2 commits intoMemTensor:openclaw-local-plugin-20260324from
hijzy:fix/0324--adapt-new-version
Mar 24, 2026
Merged

fix: use npm replace npx when installing package#1335
syzsunshine219 merged 2 commits intoMemTensor:openclaw-local-plugin-20260324from
hijzy:fix/0324--adapt-new-version

Conversation

@hijzy
Copy link
Copy Markdown
Collaborator

@hijzy hijzy commented Mar 24, 2026

Description

use npm replace npx when installing package

Related Issue (Required): Fixes #issue_number](fix: use npm replace npx when installing package)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit Test
  • Test Script Or Test Steps (please provide)
  • Pipeline Automated API Test (please provide)

Checklist

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have created related documentation issue/PR in MemOS-Docs (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

Reviewer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed
  • Tests have been provided

@hijzy
Copy link
Copy Markdown
Collaborator Author

hijzy commented Mar 24, 2026

PR Review

This PR adds two new install scripts (install.sh for Linux/macOS, install.ps1 for Windows) that replace npx with direct npm commands for plugin installation. The scripts handle Node.js version checking (>=22), auto-installation via brew/apt/dnf/winget, plugin download via npm pack, tarball extraction, dependency installation, and OpenClaw config update. The bash script uses set -euo pipefail with proper error handling. Additionally, the PR modifies index.ts to use createRequire and improve native module loading, postinstall.cjs with path normalization and shell: false, and updates package.json and SKILL.md.

The install scripts are comprehensive and well-written. However, the PowerShell script forcibly kills processes occupying the target port (Stop-Process -Id ... -Force), which could be disruptive if another service is using that port. The broad scope — combining install scripts + native module improvements + SKILL.md metadata — also makes this a higher-risk merge.

此 PR 新增了两个安装脚本(install.shinstall.ps1),用 npm 直接命令替代 npx。脚本功能完善,处理了 Node.js 版本检查、自动安装、插件下载和配置更新。但 PowerShell 脚本中会强制杀掉占用目标端口的进程,可能影响其他服务。PR 改动范围较广(安装脚本 + 原生模块改进 + SKILL.md),合并风险较高。

  • Safety: ⚠️ Port-killing in PowerShell is disruptive
  • Mergeable: After removing port-killing logic
  • Confidence: 3/5

@hijzy
Copy link
Copy Markdown
Collaborator Author

hijzy commented Mar 24, 2026

🔧 Suggested Fix

Remove or guard the port-killing logic in install.ps1 (around line 230-240). Instead of unconditionally killing processes on the target port, either remove that block entirely or add a confirmation prompt (-Confirm) before proceeding. Users can manually stop the gateway if needed.

🔧 修改建议

移除或保护 install.ps1 中的端口杀进程逻辑(约第 230-240 行)。不要无条件杀掉占用端口的进程,建议完全移除该代码块,或添加确认提示后再执行。用户可以手动停止 gateway。

@syzsunshine219 syzsunshine219 merged commit 64c0c1d into MemTensor:openclaw-local-plugin-20260324 Mar 24, 2026
@hijzy hijzy deleted the fix/0324--adapt-new-version branch April 2, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants