Releases: tuanngocptn/nport
Releases · tuanngocptn/nport
Release list
v2.1.5
Fixed
- 🛡️ EPERM Error After sudo Install: Fixed "EPERM: operation not permitted" error when running
nportafter global install withsudo npm i -g nport- When the binary is downloaded as root, it's owned by
root:rootand non-root users cannotchmodit on subsequent runs setExecutablePermissions()now checks if the file is already executable (fs.accessSync X_OK) before attemptingchmod- If chmod fails with
EPERM/EACCESon a non-executable file, a user-friendly warning is shown instead of crashing - Users who installed with
sudocan now runnportnormally without manualchmod
- When the binary is downloaded as root, it's owned by
Technical Details
setExecutablePermissions()logic:- Try
fs.accessSync(path, X_OK)— if it succeeds, the file is already executable; return immediately (no chmod) - Try
fs.chmodSync(path, '755')— if it succeeds, done - If chmod fails with
EPERM/EACCES, log a warning but don't crash; the binary was installed with sudo and should still be functional
- Try
Migration
- No action needed — existing installs are unaffected
- Users who hit the EPERM error on v2.1.4 can simply upgrade; the fix is applied on first run
Changed
- Defense-in-depth updated: Permission checks are now 5 layers:
- Postinstall: downloads binary and sets
chmod 755(as installing user or root) ensureCloudflared(): callssetExecutablePermissions()on every startupsetExecutablePermissions(): skips chmod if already executable; warns but doesn't crash on EPERMBinaryManager.validate(): checksX_OKaccess, auto-fixes with chmodBinaryManager.handleError(): shows troubleshooting tips + cleans up tunnel
- Postinstall: downloads binary and sets
v2.1.4
[2.1.4] - 2026-03-16
Fixed
- 🐧 Linux EACCES Spawn Error: Fixed "spawn cloudflared EACCES" permission denied error on Linux
- Binary now always has execute permissions verified and auto-repaired before spawning
ensureCloudflared()is called on every run, not just when the binary is missingBinaryManager.validate()now checks execute permissions (X_OK), not just file existence- Auto-fixes permissions with
chmod 755if the binary exists but isn't executable - Shows clear manual fix command (
chmod +x <path>) if auto-repair fails
- 🔧 Postinstall Binary Download: Fixed binary not being downloaded during
npm install- Postinstall script now explicitly calls
ensureCloudflared()instead of relying on module-level guard that didn't trigger during install - Errors during postinstall are now logged as warnings instead of being silently swallowed
- Users are informed the binary will be downloaded on first run if postinstall fails
- Postinstall script now explicitly calls
Improved
- 🧹 Orphaned Tunnel Cleanup: Spawn failures now trigger automatic tunnel cleanup
- Previously, if cloudflared failed to start after tunnel creation, the tunnel was left orphaned on the backend
- Now calls
TunnelOrchestrator.cleanup()on fatal spawn errors to delete the tunnel
- 💡 Linux/macOS Error Guidance: Added EACCES-specific troubleshooting tips
- Detects permission denied errors on Unix systems
- Provides actionable steps:
chmod +xcommand and reinstall instructions - Matches the existing Windows-specific error guidance
Technical Details
- Defense-in-depth: Permission issues are caught at 4 layers:
- Postinstall: downloads binary and sets
chmod 755 ensureCloudflared(): runs on every startup, re-applies permissionsBinaryManager.validate(): checksX_OKaccess, auto-fixes with chmodBinaryManager.handleError(): shows troubleshooting tips + cleans up tunnel
- Postinstall: downloads binary and sets
BinaryManager.attachHandlers(): NewonFatalErrorcallback parameter for spawn error recovery
v2.1.3
Fixed
- 🪟 Windows Spawn Error: Fixed "spawn UNKNOWN" error on Windows
- Added Windows-specific spawn options (
windowsHide,shell,stdio) - Process now spawns correctly with proper path resolution on Windows
- Added helpful troubleshooting tips for Windows users when spawn fails
- Added Windows-specific spawn options (
Improved
- 🔧 Better Windows Error Guidance: Enhanced error messages for Windows users
- Detects common spawn errors (UNKNOWN, ENOENT)
- Provides actionable troubleshooting steps:
- Check Windows Defender/antivirus blocking
- Try running as Administrator
- Reinstall nport if needed
v2.1.2
[2.1.2] - 2026-01-28
Fixed
- 📊 Analytics Integration: Fixed GA4 Measurement Protocol implementation
- Created dedicated CLI analytics stream (
G-JJHG4DP1K9) separate from website - Fixed
session_idformat (now uses numeric timestamp as required by GA4) - Fixed
engagement_time_msecto use actual number instead of string - Added
timestamp_microsfor accurate event timing - Removed debug endpoint that was preventing events from being recorded
- Added proper debug logging when
NPORT_DEBUG=true
- Created dedicated CLI analytics stream (
Changed
- 📦 Optimized Bundle Size: Switched from
tsctoesbuildfor significantly smaller package- New
scripts/build.jsbundles and minifies CLI into single file - Tree-shaking removes unused code
- Disabled TypeScript declaration and source map generation
- Reduced files in npm package (only
postinstall.jsscript included)
- New
- ⚡ Faster Development: Improved watch mode with esbuild
- Minification disabled during development for faster rebuilds
- Concurrent watching for main CLI and bin-manager entry points
- Better console output showing active file monitoring
Improved
- 🧪 Enhanced Smoke Tests: Better npm package validation in CI
- Tests now simulate full npm pack/install flow
- Installation tested from generated tarball
- More accurate pre-publish validation
Technical Details
- esbuild Configuration:
- Target: Node.js 20
- Format: ESM
- External dependencies:
axios,chalk,ora(avoids CJS/ESM issues) - Shebang added via esbuild banner instead of source file
- tsconfig.json: Updated with
noEmit: true, esbuild handles output - Package Size: Significantly reduced dist folder size
- Analytics Events:
cli_start,tunnel_created,tunnel_error,tunnel_shutdown,update_available
v2.1.1
[2.1.1] - 2026-01-27
Fixed
- 🐛 NPM Package Build: Fixed missing
dist/folder in published package- Added build step to npm-publish workflow before publishing
- Package now includes compiled JavaScript files correctly
Added
- 🚀 CI/CD Workflows: Added GitHub Actions for automated deployments
ci.yml: Runs tests on push to main and pull requestsdeploy-server.yml: Auto-deploys Cloudflare Worker on server changesdeploy-website.yml: Auto-deploys website to Cloudflare Pages on changes
- 🧪 Server Test Configuration: Fixed Vitest config for CI environment
- Added miniflare bindings for test environment variables
- Tests now pass in CI without
.dev.varsfile
- ⚙️ Wrangler Configuration: Added
preview_urlssetting to suppress warnings
v2.1.0
[2.1.0] - 2026-01-27
Added
- 🔷 Full TypeScript Migration: Complete rewrite of CLI and Server in TypeScript
- Strict type checking enabled across the entire codebase
- All modules converted from JavaScript to TypeScript
- Type-safe interfaces for configuration, tunnels, analytics, and i18n
- Better IDE support with IntelliSense and autocompletion
- 📚 Comprehensive Documentation: New docs folder with detailed guides
docs/ARCHITECTURE.md: System overview, component diagrams, and data flowdocs/API.md: Complete API reference with endpoints and examplesdocs/CONTRIBUTING.md: Contribution guidelines and development setup
- 🤖 AI Context Support: Added
.ai/context.mdfor AI-assisted development- Project structure and key patterns documented
- Coding conventions and architecture decisions
- Makes AI pair programming more effective
- 🧪 Unit Testing with Vitest: Comprehensive test suite for CLI
- Tests for argument parsing (
tests/args.test.ts) - Tests for version comparison (
tests/version.test.ts) - Tests for state management (
tests/state.test.ts) - Easy to run with
npm test
- Tests for argument parsing (
- 📋 Code Ownership: Added
.github/CODEOWNERSfile- Clear ownership for code review assignments
- Faster PR reviews with automatic reviewer assignment
- 📝 Cursor Rules: Added
.cursorrulesfor consistent AI assistance- Project-specific coding conventions
- TypeScript and naming guidelines
- Common patterns and anti-patterns
- 🔄 Auto-download Cloudflared: Binary downloads automatically on first run
- No need to run separate install commands
- Seamless first-time user experience
- Progress indicator during download
- 🔒 Protected Subdomain Support: Enhanced error handling for reserved subdomains
- User-friendly error message when trying to create protected subdomains (like
api) - Formatted error output matching existing error style
- Helpful suggestions to use alternative subdomain names
- Prevents accidental use of backend service subdomains
- User-friendly error message when trying to create protected subdomains (like
- 📋 TODO Management: Added
TODO.mdfor tracking planned features- Move time limit enforcement to backend
- Update README powered-by section
- Track terminal link clicks
Changed
- 🏗️ Project Structure: Reorganized for better maintainability
- All source code in
src/directory - Type definitions in
src/types/ - Shared constants in
src/constants.ts - Tests in
tests/directory
- All source code in
- 📦 Build System: Updated to TypeScript compilation
- Uses
tscfor compilation - Output to
dist/directory - Source maps for debugging
- Uses
- 🔧 Development Workflow: Improved developer experience
npm run devfor watch modenpm run buildfor productionnpm testfor running testsnpm run lintfor type checking
- ⚙️ System Requirements: Updated to Node.js 20+
- Minimum Node.js version: 20.0.0
- Minimum npm version: 10.0.0
- Better security and performance with latest LTS
Improved
- ✨ Better Error Messages: Enhanced user feedback for protected subdomains
- Catches
SUBDOMAIN_PROTECTEDerrors from backend - Formats error messages consistently with other error types
- Shows actionable options when subdomain is reserved
- Catches
Fixed
- 🐛 Intel Mac Binary Download: Fixed cloudflared binary download on Intel Macs
- Node.js reports architecture as
x64, notamd64- now correctly mapped - Fixed ARM64 Macs to download the correct
cloudflared-darwin-arm64.tgzbinary - Previously ARM64 Macs were incorrectly downloading the AMD64 binary
- Node.js reports architecture as
v2.0.7
[2.0.7] - 2026-01-14
Added
- 🌐 Smart Network Warning System: Intelligent handling of QUIC/network connectivity issues
- Automatic detection and filtering of QUIC protocol errors
- User-friendly warning messages instead of scary red error spam
- Bilingual support (English & Vietnamese)
- Smart throttling: Shows warning only after 5 errors, max once per 30 seconds
- Clear explanations of what's happening and how to fix it
- Automatic reset when connection is restored
- 🔒 Protected Subdomain Support: Enhanced error handling for reserved subdomains
- User-friendly error message when trying to create protected subdomains (like
api) - Formatted error output matching existing error style
- Helpful suggestions to use alternative subdomain names
- Prevents accidental use of backend service subdomains
- User-friendly error message when trying to create protected subdomains (like
Improved
- 🔇 Cleaner Terminal Output: No more error spam from cloudflared
- QUIC timeout errors are now silently tracked instead of displayed
- Network warnings filtered: "failed to accept QUIC stream", "timeout: no recent network activity", etc.
- Only shows meaningful warnings when there's an actual persistent issue
- Terminal stays clean and readable during normal operation
- 📡 Better User Communication: Context-aware network issue reporting
- Explains that QUIC failures are usually not critical
- Tunnel continues working via HTTP/2 fallback
- Provides actionable troubleshooting steps
- Reassures users that the tunnel is still functional
- ✨ Better Error Messages: Enhanced user feedback for protected subdomains
- Catches
SUBDOMAIN_PROTECTEDerrors from backend - Formats error messages consistently with other error types
- Shows actionable options when subdomain is reserved
- Catches
Technical Details
- Network Error Patterns: Added detection for 7 common QUIC/network error patterns
- State Management: New network issue tracking in application state
networkIssueCount: Counter for network errorslastNetworkWarningTime: Timestamp tracking for cooldownshouldShowNetworkWarning(): Smart decision logic
- Configuration: New
NETWORK_CONFIGwith threshold and cooldown settings - Bilingual Messages: Complete translations for all network warning messages
- Protected Subdomain Handling: Enhanced error handling in
src/api.js- Added check for
SUBDOMAIN_PROTECTEDerror type - Consistent formatting with existing error messages
- Clear user guidance for alternative subdomain choices
- Added check for
User Experience
Before:
[Cloudflared] 2026-01-14T04:33:02Z ERR failed to accept QUIC stream...
[Cloudflared] 2026-01-14T04:33:03Z ERR failed to accept QUIC stream...
[Cloudflared] 2026-01-14T04:33:04Z ERR failed to accept QUIC stream...
[Cloudflared] 2026-01-14T04:33:05Z ERR failed to accept QUIC stream...
After:
✔ [1/2] Connection established...
✔ [2/2] Compression enabled...
⚠️ NETWORK CONNECTIVITY ISSUE DETECTED
Cloudflared is having trouble maintaining a stable connection...
📡 Your tunnel is still working, but connection quality may be affected.
💡 Possible reasons:
• Unstable internet connection or high packet loss
• Firewall/Router blocking UDP traffic (QUIC protocol)
• ISP throttling or network congestion
🔧 What to try:
• Check your internet connection stability
• Try connecting from a different network
• Disable VPN/Proxy if you're using one
ℹ️ This is usually not critical - your tunnel should continue working normally.
v2.0.6
NPort v2.0.6 Release Summary
🎉 Release Date: January 13, 2026
🚀 Major Features
1. Backend URL Configuration
Full control over which backend server to use
# Save backend permanently
nport --set-backend https://api.nport.link
# Use backend temporarily
nport 3000 -b https://your-backend.com
# Use environment variable
export NPORT_BACKEND_URL=https://api.nport.link
nport 3000Priority System:
- CLI flag (
--backend/-b) - Highest - Saved config (
--set-backend) - Environment variable (
NPORT_BACKEND_URL) - Default (
https://api.nport.link) - Lowest
2. Unified Configuration System
All settings in one place
Before (v2.0.5):
- Language:
~/.nport/lang(plain text file) - No backend configuration
After (v2.0.6):
- Everything:
~/.nport/config.json(structured JSON) - Easy to read and edit
- Consistent approach
Example config file:
{
"backendUrl": "https://api.nport.link",
"language": "en"
}3. New Default Backend
Updated from nport.tuanngocptn.workers.dev to api.nport.link
Benefits:
- ✓ Professional domain structure
- ✓ Better branding with main domain
- ✓ Shorter and easier to remember
- ✓ Clearer purpose (api subdomain)
📝 Changes Summary
Added
--backend <url>/-b <url>- Temporary backend override--set-backend <url>- Save backend URL permanentlyNPORT_BACKEND_URLenvironment variable support- Unified configuration manager (
src/config-manager.js) - Automatic migration from v2.0.5 format
Changed
- Default backend URL:
api.nport.link - Language storage: Now in
config.jsoninstead of separate file - Configuration approach: Unified system for all settings
Improved
- Code organization with centralized config management
- Consistency across all configuration options
- Better documentation with comprehensive examples
🔄 Migration
Automatic Migration from v2.0.5
When you upgrade to v2.0.6, the following happens automatically:
- Old language file (
~/.nport/lang) → New config (~/.nport/config.json) - Old file deleted after successful migration
- No manual steps required
Example migration:
Before (v2.0.5):
~/.nport/lang
--------------
vi
After (v2.0.6):
~/.nport/config.json
--------------------
{
"language": "vi"
}💡 Usage Examples
Basic Usage (No changes needed!)
# Works exactly the same as before
nport 3000
nport 3000 -s myappNew: Set Backend Once
# Set it once
nport --set-backend https://api.nport.link
# Use forever
nport 3000
nport 3000 -s api
nport 8080 -s webhooksNew: Multiple Environments
# Development
nport --set-backend http://localhost:8787
nport 3000
# Switch to production
nport --set-backend https://api.nport.link
nport 3000New: Team Configuration
# Everyone on team runs once
nport --set-backend https://company-backend.example.com
# Then everyone uses nport normally
nport 3000🎯 Upgrade Instructions
NPM (Recommended)
npm install -g nport@latestVerify Version
nport -v
# Should show: NPort v2.0.6Test New Features
# 1. Set backend
nport --set-backend https://api.nport.link
# 2. Check config
cat ~/.nport/config.json
# 3. Use normally
nport 3000✅ Backward Compatibility
100% backward compatible!
- ✓ All v2.0.5 commands work exactly the same
- ✓ Automatic configuration migration
- ✓ No breaking changes
- ✓ If you don't use new features, nothing changes
📚 Documentation
Updated Files
- ✅
README.md- Main documentation with backend options - ✅
CLIENT_SETUP.md- Simplified setup guide - ✅
CHANGELOG.md- Complete changelog - ✅ All configuration examples updated
New Documentation Topics
- Backend URL configuration
- Persistent configuration
- Priority system
- Multiple environment setup
- Team configuration
🐛 Bug Fixes
No bugs fixed in this release (feature release only).
🔮 What's Next
Potential future features (not committed):
- More language options
- Additional configuration settings
- Extended timeout options
- Custom analytics preferences
💬 Feedback
We'd love to hear your thoughts on v2.0.6!
- 🐛 Bug Reports: GitHub Issues
- 💡 Feature Requests: GitHub Discussions
- ⭐ Star on GitHub: tuanngocptn/nport
- ☕ Support Development: Buy Me a Coffee
🙏 Credits
Developed by: Nick Pham
Contributors:
- Backend URL feature implementation
- Unified configuration system
- Documentation improvements
- Testing and feedback
Made with ❤️ in Vietnam
Thank you for using NPort! 🚀