diff --git a/scripts/installation/INSTALLATION_GUIDE.md b/scripts/installation/INSTALLATION_GUIDE.md index 03faf2abf..8a41bc47a 100644 --- a/scripts/installation/INSTALLATION_GUIDE.md +++ b/scripts/installation/INSTALLATION_GUIDE.md @@ -28,13 +28,13 @@ We provide platform-specific installation scripts: ```bash # Install with a specific source -./install-qwen-with-source.sh --source github +sh install-qwen-with-source.sh --source github # Install with internal source -./install-qwen-with-source.sh -s internal +sh install-qwen-with-source.sh -s internal # Show help -./install-qwen-with-source.sh --help +sh install-qwen-with-source.sh --help ``` #### Supported Source Values: @@ -51,6 +51,18 @@ We provide platform-specific installation scripts: 3. It installs Qwen Code globally 4. It creates `~/.qwen/source.json` with the specified source information +#### Important Notes: + +⚠️ **After installation, you need to restart your terminal or run:** + +```bash +source ~/.bashrc # For bash users +# or +source ~/.zshrc # For zsh users +``` + +This is required to load the newly installed Node.js and Qwen Code into your PATH. + #### Prerequisites: - curl (for NVM installation and script download) @@ -153,7 +165,7 @@ The `source.json` file contains: ### Verification -After installation, you can verify the source information: +After installation and restarting your terminal (or sourcing your shell configuration), you can verify the source information: **Linux/macOS:** @@ -197,11 +209,8 @@ brew install qwen-code **Linux/macOS:** ```bash -# Make script executable -chmod +x install-qwen-with-source.sh - -# Run with bash explicitly -bash install-qwen-with-source.sh --source github +# Run with sh +sh install-qwen-with-source.sh --source github ``` **Windows (PowerShell as Administrator):** @@ -218,7 +227,7 @@ bash install-qwen-with-source.sh --source github **Linux/macOS:** -- Ensure NVM is installed: `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash` +- Ensure NVM is installed: `curl -o- https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install_nvm.sh | bash` - Restart your terminal or run: `source ~/.bashrc` **Windows:** diff --git a/scripts/installation/install-qwen-with-source.sh b/scripts/installation/install-qwen-with-source.sh index deb4124ec..50c667e25 100755 --- a/scripts/installation/install-qwen-with-source.sh +++ b/scripts/installation/install-qwen-with-source.sh @@ -101,8 +101,17 @@ install_qwen_code() { echo "Installing Qwen Code..." - # Install Qwen Code globally (may require sudo) - if sudo npm install -g @qwen-code/qwen-code >/dev/null 2>&1; then + # Check if running as root + if [ "$(id -u)" -eq 0 ]; then + # Running as root, no need for sudo + NPM_INSTALL_CMD="npm install -g @qwen-code/qwen-code" + else + # Not root, use sudo + NPM_INSTALL_CMD="sudo npm install -g @qwen-code/qwen-code" + fi + + # Install Qwen Code globally + if $NPM_INSTALL_CMD >/dev/null 2>&1; then # Verify installation if command_exists qwen; then QWEN_VERSION=$(qwen --version 2>/dev/null || echo "unknown") @@ -131,7 +140,18 @@ main() { echo "✓ Installation completed!" echo "===========================================" echo "" - echo "Run 'qwen' to start using Qwen Code" + + # Try to source the shell configuration file + if [ -f "$HOME/.zshrc" ]; then + echo "Loading zsh configuration..." + source "$HOME/.zshrc" 2>/dev/null || true + elif [ -f "$HOME/.bashrc" ]; then + echo "Loading bash configuration..." + source "$HOME/.bashrc" 2>/dev/null || true + fi + + echo "To use Qwen Code in new terminals, run: qwen" + echo "If 'qwen' command is not found, please restart your terminal." } # Run main function