fix: add shebang to make npx execution work#5
Open
silvermissile wants to merge 1 commit intoveithly:mainfrom
Open
fix: add shebang to make npx execution work#5silvermissile wants to merge 1 commit intoveithly:mainfrom
silvermissile wants to merge 1 commit intoveithly:mainfrom
Conversation
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>
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述 / 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.tswas 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, ensuringdist/index.jscan be properly executed as a command-line tool.测试验证 / Testing
✅ 本地构建测试通过,编译后的
dist/index.js包含正确的 shebang✅ Local build tested successfully, compiled
dist/index.jscontains the correct shebang相关 Issue / Related Issue
Fixes #3
感谢 @asklar 报告这个问题!
Thanks to @asklar for reporting this issue!