Skip to content

fix: add shebang to make npx execution work#5

Open
silvermissile wants to merge 1 commit intoveithly:mainfrom
silvermissile:main
Open

fix: add shebang to make npx execution work#5
silvermissile wants to merge 1 commit intoveithly:mainfrom
silvermissile:main

Conversation

@silvermissile
Copy link

问题描述 / Problem Description

修复了使用 npx rss-mcp 时出现 import: not found 错误的问题。

Fixes the "import: not found" error when running via npx rss-mcp.

根本原因 / Root Cause

源文件 src/index.ts 缺少 shebang (#!/usr/bin/env node),导致系统将编译后的 JavaScript 文件作为 shell 脚本执行,而不是传递给 Node.js 运行时。

The source file src/index.ts was missing the shebang (#!/usr/bin/env node), causing the system to execute the compiled JavaScript file as a shell script instead of passing it to the Node.js runtime.

修复方案 / Solution

src/index.ts 文件开头添加 shebang。TypeScript 编译器会将源文件开头的 shebang 原样保留到编译输出中,确保 dist/index.js 可以作为命令行工具正确执行。

Added shebang to the beginning of src/index.ts. The TypeScript compiler preserves shebangs from source files in the compiled output, ensuring dist/index.js can be properly executed as a command-line tool.

测试验证 / Testing

✅ 本地构建测试通过,编译后的 dist/index.js 包含正确的 shebang
✅ Local build tested successfully, compiled dist/index.js contains the correct shebang

相关 Issue / Related Issue

Fixes #3


感谢 @asklar 报告这个问题!
Thanks to @asklar for reporting this issue!

Adds #!/usr/bin/env node shebang to src/index.ts to fix the "import: not found"
error when running via npx. Without the shebang, the shell tries to execute the
JavaScript file directly instead of passing it to Node.js.

TypeScript preserves shebangs from source files in the compiled output, so this
fix ensures dist/index.js can be properly executed as a command-line tool.

Fixes veithly#3

Co-authored-by: Cursor <cursoragent@cursor.com>
@silvermissile silvermissile mentioned this pull request Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing shebang

1 participant