File size: 106,734 Bytes
69b897d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 |
<template>
<div class="card p-3 sm:p-6">
<div class="mb-4 sm:mb-8">
<h3
class="mb-3 flex items-center text-xl font-bold text-gray-900 dark:text-gray-100 sm:mb-4 sm:text-2xl"
>
<i class="fas fa-graduation-cap mr-2 text-blue-600 sm:mr-3" />
Claude Code 使用教程
</h3>
<p class="text-sm text-gray-600 dark:text-gray-400 sm:text-lg">
跟着这个教程,你可以轻松在自己的电脑上安装并使用 Claude Code。
</p>
</div>
<!-- 系统选择标签 -->
<div class="mb-4 sm:mb-8">
<div class="flex flex-wrap gap-1 rounded-xl bg-gray-100 p-1 dark:bg-gray-800 sm:gap-2 sm:p-2">
<button
v-for="system in tutorialSystems"
:key="system.key"
:class="[
'flex flex-1 items-center justify-center gap-1 rounded-lg px-3 py-2 text-xs font-semibold transition-all duration-300 sm:gap-2 sm:px-6 sm:py-3 sm:text-sm',
activeTutorialSystem === system.key
? 'bg-white text-blue-600 shadow-sm dark:bg-blue-600 dark:text-white dark:shadow-blue-500/40'
: 'text-gray-600 hover:bg-white/50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white'
]"
@click="activeTutorialSystem = system.key"
>
<i :class="system.icon" />
{{ system.name }}
</button>
</div>
</div>
<!-- Windows 教程 -->
<div v-if="activeTutorialSystem === 'windows'" class="tutorial-content">
<!-- 第一步:安装 Node.js -->
<div class="mb-4 sm:mb-10 sm:mb-6">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-blue-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>1</span
>
安装 Node.js 环境
</h4>
<p class="mb-4 text-sm text-gray-600 dark:text-gray-400 sm:mb-4 sm:mb-6 sm:text-base">
Claude Code 需要 Node.js 环境才能运行。
</p>
<div
class="mb-4 rounded-xl border border-blue-100 bg-gradient-to-r from-blue-50 to-indigo-50 p-4 dark:border-blue-500/40 dark:from-blue-950/30 dark:to-indigo-950/30 sm:mb-4 sm:mb-6 sm:p-6"
>
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fab fa-windows mr-2 text-blue-600" />
Windows 安装方法
</h5>
<div class="mb-3 sm:mb-4">
<p class="mb-2 text-sm text-gray-700 dark:text-gray-300 sm:mb-3 sm:text-base">
方法一:官网下载(推荐)
</p>
<ol
class="ml-2 list-inside list-decimal space-y-1 text-xs text-gray-600 dark:text-gray-400 sm:ml-4 sm:space-y-2 sm:text-sm"
>
<li>
打开浏览器访问
<code
class="rounded bg-gray-100 px-1 py-1 text-xs dark:bg-gray-800 dark:text-yellow-400 sm:px-2 sm:text-sm"
>https://nodejs.org/</code
>
</li>
<li>点击 "LTS" 版本进行下载(推荐长期支持版本)</li>
<li>
下载完成后双击
<code
class="rounded bg-gray-100 px-1 py-1 text-xs dark:bg-gray-800 dark:text-yellow-400 sm:px-2 sm:text-sm"
>.msi</code
>
文件
</li>
<li>按照安装向导完成安装,保持默认设置即可</li>
</ol>
</div>
<div class="mb-3 sm:mb-4">
<p class="mb-2 text-sm text-gray-700 dark:text-gray-300 sm:mb-3 sm:text-base">
方法二:使用包管理器
</p>
<p class="mb-2 text-xs text-gray-600 dark:text-gray-400 sm:text-sm">
如果你安装了 Chocolatey 或 Scoop,可以使用命令行安装:
</p>
<div
class="overflow-x-auto rounded-lg bg-gray-900 p-3 font-mono text-xs text-green-400 dark:border dark:border-slate-700 dark:bg-slate-900 sm:p-4 sm:text-sm"
>
<div class="mb-2"># 使用 Chocolatey</div>
<div class="whitespace-nowrap text-gray-300">choco install nodejs</div>
<div class="mb-2 mt-3"># 或使用 Scoop</div>
<div class="whitespace-nowrap text-gray-300">scoop install nodejs</div>
</div>
</div>
<div
class="rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-blue-800 dark:text-blue-300 sm:text-base">
Windows 注意事项
</h6>
<ul class="space-y-1 text-xs text-blue-700 dark:text-blue-300 sm:text-sm sm:text-xs">
<li>• 建议使用 PowerShell 而不是 CMD</li>
<li>• 如果遇到权限问题,尝试以管理员身份运行</li>
<li>• 某些杀毒软件可能会误报,需要添加白名单</li>
</ul>
</div>
</div>
<!-- 验证安装 -->
<div
class="rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-500/40 dark:bg-green-950/30 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-green-800 dark:text-green-300 sm:text-base">
验证安装是否成功
</h6>
<p class="mb-2 text-xs text-green-700 dark:text-green-300 sm:mb-3 sm:text-sm">
安装完成后,打开 PowerShell 或 CMD,输入以下命令:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">node --version</div>
<div class="whitespace-nowrap text-gray-300">npm --version</div>
</div>
<p class="mt-2 text-xs text-green-700 dark:text-green-300 sm:text-sm">
如果显示版本号,说明安装成功了!
</p>
</div>
</div>
<!-- 第二步:安装 Claude Code -->
<div class="mb-4 sm:mb-10 sm:mb-6">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-green-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>2</span
>
安装 Claude Code
</h4>
<div
class="mb-4 rounded-xl border border-green-100 bg-gradient-to-r from-green-50 to-emerald-50 p-4 dark:border-green-500/40 dark:from-green-950/30 dark:to-emerald-950/30 sm:mb-6 sm:p-6"
>
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-download mr-2 text-green-600" />
安装 Claude Code
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
打开 PowerShell 或 CMD,运行以下命令:
</p>
<div
class="mb-4 overflow-x-auto rounded-lg bg-gray-900 p-3 font-mono text-xs text-green-400 sm:p-4 sm:text-sm"
>
<div class="mb-2"># 全局安装 Claude Code</div>
<div class="whitespace-nowrap text-gray-300">
npm install -g @anthropic-ai/claude-code
</div>
</div>
<p class="text-sm text-gray-600 dark:text-gray-400">
这个命令会从 npm 官方仓库下载并安装最新版本的 Claude Code。
</p>
<div
class="mt-4 rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-blue-800 dark:text-blue-300 sm:text-base">
提示
</h6>
<ul class="space-y-1 text-xs text-blue-700 dark:text-blue-300 sm:text-sm">
<li>• 建议使用 PowerShell 而不是 CMD,功能更强大</li>
<li>• 如果遇到权限问题,以管理员身份运行 PowerShell</li>
</ul>
</div>
</div>
<!-- 验证安装 -->
<div
class="rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-500/40 dark:bg-green-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-green-800 dark:text-green-300">验证 Claude Code 安装</h6>
<p class="mb-3 text-sm text-green-700 dark:text-green-300">
安装完成后,输入以下命令检查是否安装成功:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">claude --version</div>
</div>
<p class="mt-2 text-sm text-green-700 dark:text-green-300">
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
</p>
</div>
</div>
<!-- 第三步:设置环境变量 -->
<div class="mb-6 sm:mb-10">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-purple-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>3</span
>
设置环境变量
</h4>
<div
class="mb-4 rounded-xl border border-purple-100 bg-gradient-to-r from-purple-50 to-pink-50 p-4 dark:border-purple-500/40 dark:from-purple-950/30 dark:to-pink-950/30 sm:mb-6 sm:p-6"
>
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-cog mr-2 text-purple-600" />
配置 Claude Code 环境变量
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
为了让 Claude Code 连接到你的中转服务,需要设置两个环境变量:
</p>
<div class="space-y-4">
<div
class="rounded-lg border border-purple-200 bg-white p-3 dark:border-purple-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
方法一:PowerShell 临时设置(当前会话)
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">
在 PowerShell 中运行以下命令:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
$env:ANTHROPIC_BASE_URL = "{{ currentBaseUrl }}"
</div>
<div class="whitespace-nowrap text-gray-300">
$env:ANTHROPIC_AUTH_TOKEN = "你的API密钥"
</div>
</div>
<p class="mt-2 text-xs text-yellow-700 dark:text-yellow-400">
💡 记得将 "你的API密钥" 替换为在上方 "API Keys" 标签页中创建的实际密钥。
</p>
</div>
<div
class="rounded-lg border border-purple-200 bg-white p-3 dark:border-purple-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
方法二:PowerShell 永久设置(用户级)
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">
在 PowerShell 中运行以下命令设置用户级环境变量:
</p>
<div
class="mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 设置用户级环境变量(永久生效)</div>
<div class="whitespace-nowrap text-gray-300">
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "{{
currentBaseUrl
}}", [System.EnvironmentVariableTarget]::User)
</div>
<div class="whitespace-nowrap text-gray-300">
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN",
"你的API密钥", [System.EnvironmentVariableTarget]::User)
</div>
</div>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">查看已设置的环境变量:</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 查看用户级环境变量</div>
<div class="whitespace-nowrap text-gray-300">
[System.Environment]::GetEnvironmentVariable("ANTHROPIC_BASE_URL",
[System.EnvironmentVariableTarget]::User)
</div>
<div class="whitespace-nowrap text-gray-300">
[System.Environment]::GetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN",
[System.EnvironmentVariableTarget]::User)
</div>
</div>
<p class="mt-2 text-xs text-blue-700 dark:text-blue-300">
💡 设置后需要重新打开 PowerShell 窗口才能生效。
</p>
</div>
</div>
</div>
<!-- VSCode 插件配置 -->
<div
class="mt-6 rounded-lg border border-indigo-200 bg-indigo-50 p-3 dark:border-indigo-500/40 dark:bg-indigo-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-indigo-800 dark:text-indigo-300">
VSCode Claude 插件配置
</h6>
<p class="mb-3 text-sm text-indigo-700 dark:text-indigo-300">
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
</p>
<div class="mb-3 space-y-2">
<p class="text-sm text-indigo-700 dark:text-indigo-300">
<strong>配置文件位置:</strong>
<code class="rounded bg-indigo-100 px-1 dark:bg-indigo-900"
>C:\Users\你的用户名\.claude\config.json</code
>
</p>
<p class="text-xs text-indigo-600 dark:text-indigo-400">
💡 如果该文件不存在,请手动创建。
</p>
</div>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">{</div>
<div class="whitespace-nowrap text-gray-300">"primaryApiKey": "crs"</div>
<div class="whitespace-nowrap text-gray-300">}</div>
</div>
</div>
<!-- 验证环境变量设置 -->
<div
class="mt-6 rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-blue-800 dark:text-blue-300">验证环境变量设置</h6>
<p class="mb-3 text-sm text-blue-700 dark:text-blue-300">
设置完环境变量后,可以通过以下命令验证是否设置成功:
</p>
<div class="space-y-4">
<div>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
在 PowerShell 中验证:
</h6>
<div
class="space-y-1 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">echo $env:ANTHROPIC_BASE_URL</div>
<div class="whitespace-nowrap text-gray-300">echo $env:ANTHROPIC_AUTH_TOKEN</div>
</div>
</div>
<div>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
在 CMD 中验证:
</h6>
<div
class="space-y-1 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">echo %ANTHROPIC_BASE_URL%</div>
<div class="whitespace-nowrap text-gray-300">echo %ANTHROPIC_AUTH_TOKEN%</div>
</div>
</div>
</div>
<div class="mt-3 space-y-2">
<p class="text-sm text-blue-700 dark:text-blue-300">
<strong>预期输出示例:</strong>
</p>
<div class="rounded bg-gray-100 p-2 font-mono text-sm dark:bg-gray-700">
<div>{{ currentBaseUrl }}</div>
<div>cr_xxxxxxxxxxxxxxxxxx</div>
</div>
<p class="text-xs text-blue-700 dark:text-blue-300">
💡 如果输出为空或显示变量名本身,说明环境变量设置失败,请重新设置。
</p>
</div>
</div>
<!-- Gemini CLI 环境变量设置 -->
<div class="mt-8">
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-robot mr-2 text-green-600" />
配置 Gemini CLI 环境变量
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
如果你使用 Gemini CLI,需要设置以下环境变量:
</p>
<div class="space-y-4">
<div
class="rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
PowerShell 设置方法
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">
在 PowerShell 中运行以下命令:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
$env:GOOGLE_GEMINI_BASE_URL = "{{ geminiBaseUrl }}"
</div>
<div class="whitespace-nowrap text-gray-300">
$env:GEMINI_API_KEY = "你的API密钥"
</div>
<div class="whitespace-nowrap text-gray-300">
$env:GEMINI_MODEL = "gemini-2.5-pro"
</div>
</div>
<p class="mt-2 text-xs text-yellow-700 dark:text-yellow-400">
💡 使用与 Claude Code 相同的 API 密钥即可。
</p>
</div>
<div
class="rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
PowerShell 永久设置(用户级)
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">
在 PowerShell 中运行以下命令:
</p>
<div
class="mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 设置用户级环境变量(永久生效)</div>
<div class="whitespace-nowrap text-gray-300">
[System.Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "{{
geminiBaseUrl
}}", [System.EnvironmentVariableTarget]::User)
</div>
<div class="whitespace-nowrap text-gray-300">
[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "你的API密钥",
[System.EnvironmentVariableTarget]::User)
</div>
<div class="whitespace-nowrap text-gray-300">
[System.Environment]::SetEnvironmentVariable("GEMINI_MODEL", "gemini-2.5-pro",
[System.EnvironmentVariableTarget]::User)
</div>
</div>
<p class="mt-2 text-xs text-blue-700 dark:text-blue-300">
💡 设置后需要重新打开 PowerShell 窗口才能生效。
</p>
</div>
<div
class="rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-500/40 dark:bg-green-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-green-800 dark:text-green-300">
验证 Gemini CLI 环境变量
</h6>
<p class="mb-3 text-sm text-green-700 dark:text-green-300">在 PowerShell 中验证:</p>
<div
class="space-y-1 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">echo $env:GOOGLE_GEMINI_BASE_URL</div>
<div class="whitespace-nowrap text-gray-300">echo $env:GEMINI_API_KEY</div>
<div class="whitespace-nowrap text-gray-300">echo $env:GEMINI_MODEL</div>
</div>
</div>
</div>
</div>
<!-- Codex 环境变量设置 -->
<div class="mt-8">
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-code mr-2 text-indigo-600" />
配置 Codex 环境变量
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
如果你使用支持 OpenAI API 的工具(如 Codex),需要设置以下环境变量:
</p>
<div class="space-y-4">
<div
class="rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-500/40 dark:bg-yellow-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-yellow-800 dark:text-yellow-300">Codex 配置文件</h6>
<p class="mb-3 text-sm text-yellow-700 dark:text-yellow-300">
在
<code class="rounded bg-yellow-100 px-1 dark:bg-yellow-900"
>~/.codex/config.toml</code
>
文件开头添加以下配置:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="line in codexConfigContent.configToml"
:key="line"
class="whitespace-nowrap text-gray-300"
:class="{ 'mt-2': line === '' }"
>
{{ line }}
</div>
</div>
<p class="mt-3 text-sm text-yellow-700 dark:text-yellow-300">
在
<code class="rounded bg-yellow-100 px-1 dark:bg-yellow-900"
>~/.codex/auth.json</code
>
文件中配置API密钥:
</p>
<div
class="mt-2 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="line in codexConfigContent.authJson"
:key="line"
class="whitespace-nowrap text-gray-300"
>
{{ line }}
</div>
</div>
<div class="mt-3 space-y-3 text-xs text-yellow-700 dark:text-yellow-300">
<!-- 描述文字 -->
<p>{{ codexConfigContent.authInstructions.description }}</p>
<!-- 标题 -->
<h6 class="text-sm font-medium text-yellow-800 dark:text-yellow-200">
{{ codexConfigContent.authInstructions.title }}
</h6>
<!-- 当前平台对应的环境变量设置 -->
<div class="space-y-2">
<p class="font-medium">
{{ codexConfigContent.authInstructions.platform.title }}:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
{{ codexConfigContent.authInstructions.platform.command }}
</div>
</div>
</div>
<!-- Shell 配置文件(仅对于 macOS/Linux 显示) -->
<div v-if="codexConfigContent.authInstructions.persistent" class="space-y-2">
<p class="font-medium">
{{ codexConfigContent.authInstructions.persistent.title }}:
</p>
<p class="text-xs">
{{ codexConfigContent.authInstructions.persistent.description }}
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="command in codexConfigContent.authInstructions.persistent.commands"
:key="command"
class="whitespace-nowrap text-gray-300"
:class="{ 'mt-2': command === '' }"
>
{{ command }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Droid CLI 配置 -->
<div class="mt-8">
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-terminal mr-2 text-blue-600" />
配置 Droid CLI
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
Droid CLI 使用
<code class="rounded bg-gray-100 px-1 dark:bg-gray-800">~/.factory/config.json</code>
保存自定义模型;在 Windows 中可直接编辑
<code class="rounded bg-gray-100 px-1 dark:bg-gray-800"
>C:\Users\你的用户名\.factory\config.json</code
>。
</p>
<div
class="rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-blue-800 dark:text-blue-200 sm:text-base">
配置文件示例
</h6>
<p class="mb-3 text-sm text-blue-700 dark:text-blue-200">
将以下内容追加到配置文件中,并替换示例中的域名和 API 密钥:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="(line, index) in droidCliConfigLines"
:key="line + index"
class="whitespace-pre text-gray-300"
>
{{ line }}
</div>
</div>
<p class="mt-3 text-xs text-blue-700 dark:text-blue-200 sm:text-sm">
💡 在 Droid CLI 中选择自定义模型即可使用新的 Droid 账号池;确保服务地址可被本地访问。
</p>
</div>
</div>
<!-- 第四步:开始使用 -->
<div class="mb-6 sm:mb-8">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-orange-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>4</span
>
开始使用 Claude Code
</h4>
<div
class="rounded-xl border border-orange-100 bg-gradient-to-r from-orange-50 to-yellow-50 p-4 dark:border-orange-500/40 dark:from-orange-950/30 dark:to-yellow-950/30 sm:p-6"
>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
现在你可以开始使用 Claude Code 了!
</p>
<div class="space-y-4">
<div>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
启动 Claude Code
</h6>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">claude</div>
</div>
</div>
<div>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
在特定项目中使用
</h6>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 进入你的项目目录</div>
<div class="whitespace-nowrap text-gray-300">cd C:\path\to\your\project</div>
<div class="mb-2 mt-2"># 启动 Claude Code</div>
<div class="whitespace-nowrap text-gray-300">claude</div>
</div>
</div>
</div>
</div>
</div>
<!-- Windows 故障排除 -->
<div class="mb-8">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<i class="fas fa-wrench mr-2 text-red-600 sm:mr-3" />
Windows 常见问题解决
</h4>
<div class="space-y-4">
<details
class="rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800"
>
<summary
class="cursor-pointer p-3 text-sm font-medium text-gray-800 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4 sm:text-base"
>
安装时提示 "permission denied" 错误
</summary>
<div class="px-3 pb-3 text-gray-600 dark:text-gray-400 sm:px-4 sm:pb-4">
<p class="mb-2">这通常是权限问题,尝试以下解决方法:</p>
<ul class="list-inside list-disc space-y-1 text-sm">
<li>以管理员身份运行 PowerShell</li>
<li>
或者配置 npm 使用用户目录:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>npm config set prefix %APPDATA%\npm</code
>
</li>
</ul>
</div>
</details>
<details
class="rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800"
>
<summary
class="cursor-pointer p-3 text-sm font-medium text-gray-800 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4 sm:text-base"
>
PowerShell 执行策略错误
</summary>
<div class="px-3 pb-3 text-gray-600 dark:text-gray-400 sm:px-4 sm:pb-4">
<p class="mb-2">如果遇到执行策略限制,运行:</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
</div>
</div>
</div>
</details>
<details
class="rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800"
>
<summary
class="cursor-pointer p-3 text-sm font-medium text-gray-800 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4 sm:text-base"
>
环境变量设置后不生效
</summary>
<div class="px-3 pb-3 text-gray-600 dark:text-gray-400 sm:px-4 sm:pb-4">
<p class="mb-2">设置永久环境变量后需要:</p>
<ul class="list-inside list-disc space-y-1 text-sm">
<li>重新启动 PowerShell 或 CMD</li>
<li>或者注销并重新登录 Windows</li>
<li>
验证设置:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>echo $env:ANTHROPIC_BASE_URL</code
>
</li>
</ul>
</div>
</details>
</div>
</div>
</div>
<!-- macOS 教程 -->
<div v-else-if="activeTutorialSystem === 'macos'" class="tutorial-content">
<!-- 第一步:安装 Node.js -->
<div class="mb-6 sm:mb-10">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-blue-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>1</span
>
安装 Node.js 环境
</h4>
<p class="mb-4 text-gray-600 dark:text-gray-400 sm:mb-6">
Claude Code 需要 Node.js 环境才能运行。
</p>
<div
class="mb-4 rounded-xl border border-gray-200 bg-gradient-to-r from-gray-50 to-slate-50 p-4 dark:border-gray-700 dark:from-gray-800 dark:to-slate-800 sm:mb-6 sm:p-6"
>
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fab fa-apple mr-2 text-gray-700 dark:text-gray-400" />
macOS 安装方法
</h5>
<div class="mb-4">
<p class="mb-3 text-gray-700 dark:text-gray-300">方法一:使用 Homebrew(推荐)</p>
<p class="mb-2 text-xs text-gray-600 dark:text-gray-400 sm:text-sm">
如果你已经安装了 Homebrew,使用它安装 Node.js 会更方便:
</p>
<div
class="overflow-x-auto rounded-lg bg-gray-900 p-3 font-mono text-xs text-green-400 dark:border dark:border-slate-700 dark:bg-slate-900 sm:p-4 sm:text-sm"
>
<div class="mb-2"># 更新 Homebrew</div>
<div class="whitespace-nowrap text-gray-300">brew update</div>
<div class="mb-2 mt-3"># 安装 Node.js</div>
<div class="whitespace-nowrap text-gray-300">brew install node</div>
</div>
</div>
<div class="mb-4">
<p class="mb-3 text-gray-700 dark:text-gray-300">方法二:官网下载</p>
<ol
class="ml-2 list-inside list-decimal space-y-1 text-xs text-gray-600 dark:text-gray-400 sm:ml-4 sm:space-y-2 sm:text-sm"
>
<li>
访问
<code
class="rounded bg-gray-100 px-1 py-1 text-xs dark:bg-gray-700 sm:px-2 sm:text-sm"
>https://nodejs.org/</code
>
</li>
<li>下载适合 macOS 的 LTS 版本</li>
<li>
打开下载的
<code
class="rounded bg-gray-100 px-1 py-1 text-xs dark:bg-gray-700 sm:px-2 sm:text-sm"
>.pkg</code
>
文件
</li>
<li>按照安装程序指引完成安装</li>
</ol>
</div>
<div
class="rounded-lg border border-gray-200 bg-gray-50 p-3 dark:border-gray-600 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
macOS 注意事项
</h6>
<ul class="space-y-1 text-xs text-gray-700 dark:text-gray-300 sm:text-sm">
<li>
• 如果遇到权限问题,可能需要使用
<code class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>sudo</code
>
</li>
<li>• 首次运行可能需要在系统偏好设置中允许</li>
<li>• 建议使用 Terminal 或 iTerm2</li>
</ul>
</div>
</div>
<!-- 验证安装 -->
<div
class="rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-500/40 dark:bg-green-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-green-800 dark:text-green-300">验证安装是否成功</h6>
<p class="mb-3 text-sm text-green-700 dark:text-green-300">
安装完成后,打开 Terminal,输入以下命令:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">node --version</div>
<div class="whitespace-nowrap text-gray-300">npm --version</div>
</div>
<p class="mt-2 text-sm text-green-700 dark:text-green-300">
如果显示版本号,说明安装成功了!
</p>
</div>
</div>
<!-- 第二步:安装 Claude Code -->
<div class="mb-6 sm:mb-10">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-green-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>2</span
>
安装 Claude Code
</h4>
<div
class="mb-4 rounded-xl border border-purple-100 bg-gradient-to-r from-purple-50 to-pink-50 p-4 dark:border-purple-500/40 dark:from-purple-950/30 dark:to-pink-950/30 sm:mb-6 sm:p-6"
>
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-download mr-2 text-purple-600" />
安装 Claude Code
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
打开 Terminal,运行以下命令:
</p>
<div
class="mb-4 overflow-x-auto rounded-lg bg-gray-900 p-3 font-mono text-xs text-green-400 sm:p-4 sm:text-sm"
>
<div class="mb-2"># 全局安装 Claude Code</div>
<div class="whitespace-nowrap text-gray-300">
npm install -g @anthropic-ai/claude-code
</div>
</div>
<p class="mb-2 text-sm text-gray-600 dark:text-gray-400">
如果遇到权限问题,可以使用 sudo:
</p>
<div
class="overflow-x-auto rounded-lg bg-gray-900 p-3 font-mono text-xs text-green-400 sm:p-4 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
sudo npm install -g @anthropic-ai/claude-code
</div>
</div>
</div>
<!-- 验证安装 -->
<div
class="rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-500/40 dark:bg-green-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-green-800 dark:text-green-300">验证 Claude Code 安装</h6>
<p class="mb-3 text-sm text-green-700 dark:text-green-300">
安装完成后,输入以下命令检查是否安装成功:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">claude --version</div>
</div>
<p class="mt-2 text-sm text-green-700 dark:text-green-300">
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
</p>
</div>
</div>
<!-- 第三步:设置环境变量 -->
<div class="mb-6 sm:mb-10">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-orange-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>3</span
>
设置环境变量
</h4>
<div
class="mb-4 rounded-xl border border-orange-100 bg-gradient-to-r from-orange-50 to-yellow-50 p-4 dark:border-orange-500/40 dark:from-orange-950/30 dark:to-yellow-950/30 sm:mb-6 sm:p-6"
>
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-cog mr-2 text-orange-600" />
配置 Claude Code 环境变量
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
为了让 Claude Code 连接到你的中转服务,需要设置两个环境变量:
</p>
<div class="space-y-4">
<div
class="rounded-lg border border-orange-200 bg-white p-3 dark:border-orange-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
方法一:临时设置(当前会话)
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">
在 Terminal 中运行以下命令:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
export ANTHROPIC_BASE_URL="{{ currentBaseUrl }}"
</div>
<div class="whitespace-nowrap text-gray-300">
export ANTHROPIC_AUTH_TOKEN="你的API密钥"
</div>
</div>
<p class="mt-2 text-xs text-yellow-700 dark:text-yellow-400">
💡 记得将 "你的API密钥" 替换为在上方 "API Keys" 标签页中创建的实际密钥。
</p>
</div>
<div
class="rounded-lg border border-orange-200 bg-white p-3 dark:border-orange-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
方法二:永久设置
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">
编辑你的 shell 配置文件(根据你使用的 shell):
</p>
<div
class="mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 对于 zsh (默认)</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export ANTHROPIC_BASE_URL="{{ currentBaseUrl }}"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export ANTHROPIC_AUTH_TOKEN="你的API密钥"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">source ~/.zshrc</div>
</div>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 对于 bash</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export ANTHROPIC_BASE_URL="{{ currentBaseUrl }}"' >> ~/.bash_profile
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export ANTHROPIC_AUTH_TOKEN="你的API密钥"' >> ~/.bash_profile
</div>
<div class="whitespace-nowrap text-gray-300">source ~/.bash_profile</div>
</div>
</div>
</div>
</div>
<!-- VSCode 插件配置 (macOS) -->
<div
class="mt-6 rounded-lg border border-indigo-200 bg-indigo-50 p-3 dark:border-indigo-500/40 dark:bg-indigo-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-indigo-800 dark:text-indigo-300">
VSCode Claude 插件配置
</h6>
<p class="mb-3 text-sm text-indigo-700 dark:text-indigo-300">
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
</p>
<div class="mb-3 space-y-2">
<p class="text-sm text-indigo-700 dark:text-indigo-300">
<strong>配置文件位置:</strong>
<code class="rounded bg-indigo-100 px-1 dark:bg-indigo-900"
>~/.claude/config.json</code
>
</p>
<p class="text-xs text-indigo-600 dark:text-indigo-400">
💡 如果该文件不存在,请手动创建。
</p>
</div>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">{</div>
<div class="whitespace-nowrap text-gray-300">"primaryApiKey": "crs"</div>
<div class="whitespace-nowrap text-gray-300">}</div>
</div>
</div>
<!-- Gemini CLI 环境变量设置 -->
<div class="mt-8">
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-robot mr-2 text-green-600" />
配置 Gemini CLI 环境变量
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
如果你使用 Gemini CLI,需要设置以下环境变量:
</p>
<div class="space-y-4">
<div
class="rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
Terminal 设置方法
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">
在 Terminal 中运行以下命令:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
export GOOGLE_GEMINI_BASE_URL="{{ geminiBaseUrl }}"
</div>
<div class="whitespace-nowrap text-gray-300">
export GEMINI_API_KEY="你的API密钥"
</div>
<div class="whitespace-nowrap text-gray-300">
export GEMINI_MODEL="gemini-2.5-pro"
</div>
</div>
<p class="mt-2 text-xs text-yellow-700 dark:text-yellow-400">
💡 使用与 Claude Code 相同的 API 密钥即可。
</p>
</div>
<div
class="rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
永久设置方法
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">
添加到你的 shell 配置文件:
</p>
<div
class="mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 对于 zsh (默认)</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GOOGLE_GEMINI_BASE_URL="{{ geminiBaseUrl }}"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GEMINI_API_KEY="你的API密钥"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GEMINI_MODEL="gemini-2.5-pro"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">source ~/.zshrc</div>
</div>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 对于 bash</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GOOGLE_GEMINI_BASE_URL="{{ geminiBaseUrl }}"' >> ~/.bash_profile
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GEMINI_API_KEY="你的API密钥"' >> ~/.bash_profile
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GEMINI_MODEL="gemini-2.5-pro"' >> ~/.bash_profile
</div>
<div class="whitespace-nowrap text-gray-300">source ~/.bash_profile</div>
</div>
</div>
<div
class="rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-500/40 dark:bg-green-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-green-800 dark:text-green-300">
验证 Gemini CLI 环境变量
</h6>
<p class="mb-3 text-sm text-green-700 dark:text-green-300">在 Terminal 中验证:</p>
<div
class="space-y-1 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">echo $GOOGLE_GEMINI_BASE_URL</div>
<div class="whitespace-nowrap text-gray-300">echo $GEMINI_API_KEY</div>
<div class="whitespace-nowrap text-gray-300">echo $GEMINI_MODEL</div>
</div>
</div>
</div>
</div>
<!-- Codex 环境变量设置 -->
<div class="mt-8">
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-code mr-2 text-indigo-600" />
配置 Codex 环境变量
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
如果你使用支持 OpenAI API 的工具(如 Codex),需要设置以下环境变量:
</p>
<div class="space-y-4">
<div
class="rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-500/40 dark:bg-yellow-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-yellow-800 dark:text-yellow-300">Codex 配置文件</h6>
<p class="mb-3 text-sm text-yellow-700 dark:text-yellow-300">
在
<code class="rounded bg-yellow-100 px-1 dark:bg-yellow-900"
>~/.codex/config.toml</code
>
文件开头添加以下配置:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="line in codexConfigContent.configToml"
:key="line"
class="whitespace-nowrap text-gray-300"
:class="{ 'mt-2': line === '' }"
>
{{ line }}
</div>
</div>
<p class="mt-3 text-sm text-yellow-700 dark:text-yellow-300">
在
<code class="rounded bg-yellow-100 px-1 dark:bg-yellow-900"
>~/.codex/auth.json</code
>
文件中配置API密钥:
</p>
<div
class="mt-2 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="line in codexConfigContent.authJson"
:key="line"
class="whitespace-nowrap text-gray-300"
>
{{ line }}
</div>
</div>
<div class="mt-3 space-y-3 text-xs text-yellow-700 dark:text-yellow-300">
<!-- 描述文字 -->
<p>{{ codexConfigContent.authInstructions.description }}</p>
<!-- 标题 -->
<h6 class="text-sm font-medium text-yellow-800 dark:text-yellow-200">
{{ codexConfigContent.authInstructions.title }}
</h6>
<!-- 当前平台对应的环境变量设置 -->
<div class="space-y-2">
<p class="font-medium">
{{ codexConfigContent.authInstructions.platform.title }}:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
{{ codexConfigContent.authInstructions.platform.command }}
</div>
</div>
</div>
<!-- Shell 配置文件(仅对于 macOS/Linux 显示) -->
<div v-if="codexConfigContent.authInstructions.persistent" class="space-y-2">
<p class="font-medium">
{{ codexConfigContent.authInstructions.persistent.title }}:
</p>
<p class="text-xs">
{{ codexConfigContent.authInstructions.persistent.description }}
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="command in codexConfigContent.authInstructions.persistent.commands"
:key="command"
class="whitespace-nowrap text-gray-300"
:class="{ 'mt-2': command === '' }"
>
{{ command }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Droid CLI 配置 -->
<div class="mt-8">
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-terminal mr-2 text-blue-600" />
配置 Droid CLI
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
Droid CLI 使用
<code class="rounded bg-gray-100 px-1 dark:bg-gray-800">~/.factory/config.json</code>
保存自定义模型;你可以在 Finder 中按
<code class="rounded bg-gray-100 px-1 dark:bg-gray-800">⌘ + Shift + G</code>
并输入路径,或运行
<code class="rounded bg-gray-100 px-1 dark:bg-gray-800">open ~/.factory</code>
快速打开配置目录。
</p>
<div
class="rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-blue-800 dark:text-blue-200 sm:text-base">
配置文件示例
</h6>
<p class="mb-3 text-sm text-blue-700 dark:text-blue-200">
将以下内容追加到配置文件中,并替换示例中的域名和 API 密钥:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="(line, index) in droidCliConfigLines"
:key="line + index"
class="whitespace-pre text-gray-300"
>
{{ line }}
</div>
</div>
<p class="mt-3 text-xs text-blue-700 dark:text-blue-200 sm:text-sm">
💡 在 Droid CLI 中选择自定义模型即可使用新的 Droid 账号池;确保服务地址可被本地访问。
</p>
</div>
</div>
<!-- 第四步:开始使用 -->
<div class="mb-8">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-yellow-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>4</span
>
开始使用 Claude Code
</h4>
<div
class="rounded-xl border border-yellow-100 bg-gradient-to-r from-yellow-50 to-amber-50 p-4 dark:border-yellow-500/40 dark:from-yellow-950/30 dark:to-amber-950/30 sm:p-6"
>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
现在你可以开始使用 Claude Code 了!
</p>
<div class="space-y-4">
<div>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
启动 Claude Code
</h6>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">claude</div>
</div>
</div>
<div>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
在特定项目中使用
</h6>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 进入你的项目目录</div>
<div class="whitespace-nowrap text-gray-300">cd /path/to/your/project</div>
<div class="mb-2 mt-2"># 启动 Claude Code</div>
<div class="whitespace-nowrap text-gray-300">claude</div>
</div>
</div>
</div>
</div>
</div>
<!-- macOS 故障排除 -->
<div class="mb-8">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<i class="fas fa-wrench mr-2 text-red-600 sm:mr-3" />
macOS 常见问题解决
</h4>
<div class="space-y-4">
<details
class="rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800"
>
<summary
class="cursor-pointer p-3 text-sm font-medium text-gray-800 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4 sm:text-base"
>
安装时提示权限错误
</summary>
<div class="px-3 pb-3 text-gray-600 dark:text-gray-400 sm:px-4 sm:pb-4">
<p class="mb-2">尝试以下解决方法:</p>
<ul class="list-inside list-disc space-y-1 text-sm">
<li>
使用 sudo 安装:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>sudo npm install -g @anthropic-ai/claude-code</code
>
</li>
<li>
或者配置 npm 使用用户目录:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>npm config set prefix ~/.npm-global</code
>
</li>
</ul>
</div>
</details>
<details
class="rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800"
>
<summary
class="cursor-pointer p-3 text-sm font-medium text-gray-800 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4 sm:text-base"
>
macOS 安全设置阻止运行
</summary>
<div class="px-3 pb-3 text-gray-600 dark:text-gray-400 sm:px-4 sm:pb-4">
<p class="mb-2">如果系统阻止运行 Claude Code:</p>
<ul class="list-inside list-disc space-y-1 text-sm">
<li>打开"系统偏好设置" → "安全性与隐私"</li>
<li>点击"仍要打开"或"允许"</li>
<li>
或者在 Terminal 中运行:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>sudo spctl --master-disable</code
>
</li>
</ul>
</div>
</details>
<details
class="rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800"
>
<summary
class="cursor-pointer p-3 text-sm font-medium text-gray-800 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4 sm:text-base"
>
环境变量不生效
</summary>
<div class="px-3 pb-3 text-gray-600 dark:text-gray-400 sm:px-4 sm:pb-4">
<p class="mb-2">检查以下几点:</p>
<ul class="list-inside list-disc space-y-1 text-sm">
<li>确认修改了正确的配置文件(.zshrc 或 .bash_profile)</li>
<li>重新启动 Terminal</li>
<li>
验证设置:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>echo $ANTHROPIC_BASE_URL</code
>
</li>
</ul>
</div>
</details>
</div>
</div>
</div>
<!-- Linux 教程 -->
<div v-else-if="activeTutorialSystem === 'linux'" class="tutorial-content">
<!-- 第一步:安装 Node.js -->
<div class="mb-6 sm:mb-10">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-blue-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>1</span
>
安装 Node.js 环境
</h4>
<p class="mb-4 text-gray-600 dark:text-gray-400 sm:mb-6">
Claude Code 需要 Node.js 环境才能运行。
</p>
<div
class="mb-4 rounded-xl border border-orange-100 bg-gradient-to-r from-orange-50 to-red-50 p-4 dark:border-orange-500/40 dark:from-orange-950/30 dark:to-red-950/30 sm:mb-6 sm:p-6"
>
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fab fa-ubuntu mr-2 text-orange-600" />
Linux 安装方法
</h5>
<div class="mb-4">
<p class="mb-3 text-gray-700 dark:text-gray-300">方法一:使用官方仓库(推荐)</p>
<div
class="overflow-x-auto rounded-lg bg-gray-900 p-3 font-mono text-xs text-green-400 dark:border dark:border-slate-700 dark:bg-slate-900 sm:p-4 sm:text-sm"
>
<div class="mb-2"># 添加 NodeSource 仓库</div>
<div class="whitespace-nowrap text-gray-300">
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
</div>
<div class="mb-2 mt-3"># 安装 Node.js</div>
<div class="whitespace-nowrap text-gray-300">sudo apt-get install -y nodejs</div>
</div>
</div>
<div class="mb-4">
<p class="mb-3 text-gray-700 dark:text-gray-300">方法二:使用系统包管理器</p>
<p class="mb-2 text-xs text-gray-600 dark:text-gray-400 sm:text-sm">
虽然版本可能不是最新的,但对于基本使用已经足够:
</p>
<div
class="overflow-x-auto rounded-lg bg-gray-900 p-3 font-mono text-xs text-green-400 dark:border dark:border-slate-700 dark:bg-slate-900 sm:p-4 sm:text-sm"
>
<div class="mb-2"># Ubuntu/Debian</div>
<div class="whitespace-nowrap text-gray-300">sudo apt update</div>
<div class="whitespace-nowrap text-gray-300">sudo apt install nodejs npm</div>
<div class="mb-2 mt-3"># CentOS/RHEL/Fedora</div>
<div class="whitespace-nowrap text-gray-300">sudo dnf install nodejs npm</div>
</div>
</div>
<div
class="rounded-lg border border-orange-200 bg-orange-50 p-3 dark:border-orange-500/40 dark:bg-orange-950/30 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-orange-800 dark:text-orange-300 sm:text-base">
Linux 注意事项
</h6>
<ul class="space-y-1 text-xs text-orange-700 dark:text-orange-300 sm:text-sm">
<li>• 某些发行版可能需要安装额外的依赖</li>
<li>
• 如果遇到权限问题,使用
<code class="rounded bg-orange-200 px-1 dark:bg-orange-900">sudo</code>
</li>
<li>• 确保你的用户在 npm 的全局目录有写权限</li>
</ul>
</div>
</div>
<!-- 验证安装 -->
<div
class="rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-500/40 dark:bg-green-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-green-800 dark:text-green-300">验证安装是否成功</h6>
<p class="mb-3 text-sm text-green-700 dark:text-green-300">
安装完成后,打开终端,输入以下命令:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">node --version</div>
<div class="whitespace-nowrap text-gray-300">npm --version</div>
</div>
<p class="mt-2 text-sm text-green-700 dark:text-green-300">
如果显示版本号,说明安装成功了!
</p>
</div>
</div>
<!-- 第二步:安装 Claude Code -->
<div class="mb-6 sm:mb-10">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-green-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>2</span
>
安装 Claude Code
</h4>
<div
class="mb-4 rounded-xl border border-purple-100 bg-gradient-to-r from-purple-50 to-pink-50 p-4 dark:border-purple-500/40 dark:from-purple-950/30 dark:to-pink-950/30 sm:mb-6 sm:p-6"
>
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-download mr-2 text-purple-600" />
安装 Claude Code
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
打开终端,运行以下命令:
</p>
<div
class="mb-4 overflow-x-auto rounded-lg bg-gray-900 p-3 font-mono text-xs text-green-400 sm:p-4 sm:text-sm"
>
<div class="mb-2"># 全局安装 Claude Code</div>
<div class="whitespace-nowrap text-gray-300">
npm install -g @anthropic-ai/claude-code
</div>
</div>
<p class="mb-2 text-sm text-gray-600 dark:text-gray-400">
如果遇到权限问题,可以使用 sudo:
</p>
<div
class="overflow-x-auto rounded-lg bg-gray-900 p-3 font-mono text-xs text-green-400 sm:p-4 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
sudo npm install -g @anthropic-ai/claude-code
</div>
</div>
</div>
<!-- 验证安装 -->
<div
class="rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-500/40 dark:bg-green-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-green-800 dark:text-green-300">验证 Claude Code 安装</h6>
<p class="mb-3 text-sm text-green-700 dark:text-green-300">
安装完成后,输入以下命令检查是否安装成功:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">claude --version</div>
</div>
<p class="mt-2 text-sm text-green-700 dark:text-green-300">
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
</p>
</div>
</div>
<!-- 第三步:设置环境变量 -->
<div class="mb-6 sm:mb-10">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-orange-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>3</span
>
设置环境变量
</h4>
<div
class="mb-4 rounded-xl border border-orange-100 bg-gradient-to-r from-orange-50 to-yellow-50 p-4 dark:border-orange-500/40 dark:from-orange-950/30 dark:to-yellow-950/30 sm:mb-6 sm:p-6"
>
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-cog mr-2 text-orange-600" />
配置 Claude Code 环境变量
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
为了让 Claude Code 连接到你的中转服务,需要设置两个环境变量:
</p>
<div class="space-y-4">
<div
class="rounded-lg border border-orange-200 bg-white p-3 dark:border-orange-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
方法一:临时设置(当前会话)
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">在终端中运行以下命令:</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
export ANTHROPIC_BASE_URL="{{ currentBaseUrl }}"
</div>
<div class="whitespace-nowrap text-gray-300">
export ANTHROPIC_AUTH_TOKEN="你的API密钥"
</div>
</div>
<p class="mt-2 text-xs text-yellow-700 dark:text-yellow-400">
💡 记得将 "你的API密钥" 替换为在上方 "API Keys" 标签页中创建的实际密钥。
</p>
</div>
<div
class="rounded-lg border border-orange-200 bg-white p-3 dark:border-orange-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
方法二:永久设置
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">编辑你的 shell 配置文件:</p>
<div
class="mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 对于 bash (默认)</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export ANTHROPIC_BASE_URL="{{ currentBaseUrl }}"' >> ~/.bashrc
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export ANTHROPIC_AUTH_TOKEN="你的API密钥"' >> ~/.bashrc
</div>
<div class="whitespace-nowrap text-gray-300">source ~/.bashrc</div>
</div>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 对于 zsh</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export ANTHROPIC_BASE_URL="{{ currentBaseUrl }}"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export ANTHROPIC_AUTH_TOKEN="你的API密钥"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">source ~/.zshrc</div>
</div>
</div>
</div>
</div>
<!-- Gemini CLI 环境变量设置 -->
<div class="mt-8">
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-robot mr-2 text-green-600" />
配置 Gemini CLI 环境变量
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
如果你使用 Gemini CLI,需要设置以下环境变量:
</p>
<div class="space-y-4">
<div
class="rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
终端设置方法
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">在终端中运行以下命令:</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
export GOOGLE_GEMINI_BASE_URL="{{ geminiBaseUrl }}"
</div>
<div class="whitespace-nowrap text-gray-300">
export GEMINI_API_KEY="你的API密钥"
</div>
<div class="whitespace-nowrap text-gray-300">
export GEMINI_MODEL="gemini-2.5-pro"
</div>
</div>
<p class="mt-2 text-xs text-yellow-700 dark:text-yellow-400">
💡 使用与 Claude Code 相同的 API 密钥即可。
</p>
</div>
<div
class="rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
永久设置方法
</h6>
<p class="mb-3 text-sm text-gray-600 dark:text-gray-400">
添加到你的 shell 配置文件:
</p>
<div
class="mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 对于 bash (默认)</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GOOGLE_GEMINI_BASE_URL="{{ geminiBaseUrl }}"' >> ~/.bashrc
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GEMINI_API_KEY="你的API密钥"' >> ~/.bashrc
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GEMINI_MODEL="gemini-2.5-pro"' >> ~/.bashrc
</div>
<div class="whitespace-nowrap text-gray-300">source ~/.bashrc</div>
</div>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 对于 zsh</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GOOGLE_GEMINI_BASE_URL="{{ geminiBaseUrl }}"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GEMINI_API_KEY="你的API密钥"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">
echo 'export GEMINI_MODEL="gemini-2.5-pro"' >> ~/.zshrc
</div>
<div class="whitespace-nowrap text-gray-300">source ~/.zshrc</div>
</div>
</div>
<div
class="rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-500/40 dark:bg-green-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-green-800 dark:text-green-300">
验证 Gemini CLI 环境变量
</h6>
<p class="mb-3 text-sm text-green-700 dark:text-green-300">在终端中验证:</p>
<div
class="space-y-1 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">echo $GOOGLE_GEMINI_BASE_URL</div>
<div class="whitespace-nowrap text-gray-300">echo $GEMINI_API_KEY</div>
<div class="whitespace-nowrap text-gray-300">echo $GEMINI_MODEL</div>
</div>
</div>
</div>
</div>
<!-- Codex 环境变量设置 -->
<div class="mt-8">
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-code mr-2 text-indigo-600" />
配置 Codex 环境变量
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
如果你使用支持 OpenAI API 的工具(如 Codex),需要设置以下环境变量:
</p>
<div class="space-y-4">
<div
class="rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-500/40 dark:bg-yellow-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-yellow-800 dark:text-yellow-300">Codex 配置文件</h6>
<p class="mb-3 text-sm text-yellow-700 dark:text-yellow-300">
在
<code class="rounded bg-yellow-100 px-1 dark:bg-yellow-900"
>~/.codex/config.toml</code
>
文件开头添加以下配置:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="line in codexConfigContent.configToml"
:key="line"
class="whitespace-nowrap text-gray-300"
:class="{ 'mt-2': line === '' }"
>
{{ line }}
</div>
</div>
<p class="mt-3 text-sm text-yellow-700 dark:text-yellow-300">
在
<code class="rounded bg-yellow-100 px-1 dark:bg-yellow-900"
>~/.codex/auth.json</code
>
文件中配置API密钥:
</p>
<div
class="mt-2 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="line in codexConfigContent.authJson"
:key="line"
class="whitespace-nowrap text-gray-300"
>
{{ line }}
</div>
</div>
<div class="mt-3 space-y-3 text-xs text-yellow-700 dark:text-yellow-300">
<!-- 描述文字 -->
<p>{{ codexConfigContent.authInstructions.description }}</p>
<!-- 标题 -->
<h6 class="text-sm font-medium text-yellow-800 dark:text-yellow-200">
{{ codexConfigContent.authInstructions.title }}
</h6>
<!-- 当前平台对应的环境变量设置 -->
<div class="space-y-2">
<p class="font-medium">
{{ codexConfigContent.authInstructions.platform.title }}:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">
{{ codexConfigContent.authInstructions.platform.command }}
</div>
</div>
</div>
<!-- Shell 配置文件(仅对于 macOS/Linux 显示) -->
<div v-if="codexConfigContent.authInstructions.persistent" class="space-y-2">
<p class="font-medium">
{{ codexConfigContent.authInstructions.persistent.title }}:
</p>
<p class="text-xs">
{{ codexConfigContent.authInstructions.persistent.description }}
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="command in codexConfigContent.authInstructions.persistent.commands"
:key="command"
class="whitespace-nowrap text-gray-300"
:class="{ 'mt-2': command === '' }"
>
{{ command }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- VSCode 插件配置 (Linux) -->
<div
class="mt-6 rounded-lg border border-indigo-200 bg-indigo-50 p-3 dark:border-indigo-500/40 dark:bg-indigo-950/30 sm:p-4"
>
<h6 class="mb-2 font-medium text-indigo-800 dark:text-indigo-300">
VSCode Claude 插件配置
</h6>
<p class="mb-3 text-sm text-indigo-700 dark:text-indigo-300">
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
</p>
<div class="mb-3 space-y-2">
<p class="text-sm text-indigo-700 dark:text-indigo-300">
<strong>配置文件位置:</strong>
<code class="rounded bg-indigo-100 px-1 dark:bg-indigo-900"
>~/.claude/config.json</code
>
</p>
<p class="text-xs text-indigo-600 dark:text-indigo-400">
💡 如果该文件不存在,请手动创建。
</p>
</div>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">{</div>
<div class="whitespace-nowrap text-gray-300">"primaryApiKey": "crs"</div>
<div class="whitespace-nowrap text-gray-300">}</div>
</div>
</div>
<!-- Droid CLI 配置 -->
<div class="mt-8">
<h5
class="mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"
>
<i class="fas fa-terminal mr-2 text-blue-600" />
配置 Droid CLI
</h5>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
Droid CLI 使用
<code class="rounded bg-gray-100 px-1 dark:bg-gray-800">~/.factory/config.json</code>
保存自定义模型;在 Linux 或 WSL2 中,可直接编辑
<code class="rounded bg-gray-100 px-1 dark:bg-gray-800"
>/home/你的用户名/.factory/config.json</code
>
或在终端运行
<code class="rounded bg-gray-100 px-1 dark:bg-gray-800">xdg-open ~/.factory</code>
打开目录。
</p>
<div
class="rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"
>
<h6 class="mb-2 text-sm font-medium text-blue-800 dark:text-blue-200 sm:text-base">
配置文件示例
</h6>
<p class="mb-3 text-sm text-blue-700 dark:text-blue-200">
将以下内容追加到配置文件中,并替换示例中的域名和 API 密钥:
</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div
v-for="(line, index) in droidCliConfigLines"
:key="line + index"
class="whitespace-pre text-gray-300"
>
{{ line }}
</div>
</div>
<p class="mt-3 text-xs text-blue-700 dark:text-blue-200 sm:text-sm">
💡 在 Droid CLI 中选择自定义模型即可使用新的 Droid 账号池;确保服务地址可被本地访问。
</p>
</div>
</div>
<!-- 第四步:开始使用 -->
<div class="mb-8">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<span
class="mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-yellow-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"
>4</span
>
开始使用 Claude Code
</h4>
<div
class="rounded-xl border border-yellow-100 bg-gradient-to-r from-yellow-50 to-amber-50 p-4 dark:border-yellow-500/40 dark:from-yellow-950/30 dark:to-amber-950/30 sm:p-6"
>
<p class="mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base">
现在你可以开始使用 Claude Code 了!
</p>
<div class="space-y-4">
<div>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
启动 Claude Code
</h6>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="whitespace-nowrap text-gray-300">claude</div>
</div>
</div>
<div>
<h6 class="mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base">
在特定项目中使用
</h6>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># 进入你的项目目录</div>
<div class="whitespace-nowrap text-gray-300">cd /path/to/your/project</div>
<div class="mb-2 mt-2"># 启动 Claude Code</div>
<div class="whitespace-nowrap text-gray-300">claude</div>
</div>
</div>
</div>
</div>
</div>
<!-- Linux 故障排除 -->
<div class="mb-8">
<h4
class="mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"
>
<i class="fas fa-wrench mr-2 text-red-600 sm:mr-3" />
Linux 常见问题解决
</h4>
<div class="space-y-4">
<details
class="rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800"
>
<summary
class="cursor-pointer p-3 text-sm font-medium text-gray-800 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4 sm:text-base"
>
安装时提示权限错误
</summary>
<div class="px-3 pb-3 text-gray-600 dark:text-gray-400 sm:px-4 sm:pb-4">
<p class="mb-2">尝试以下解决方法:</p>
<ul class="list-inside list-disc space-y-1 text-sm">
<li>
使用 sudo 安装:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>sudo npm install -g @anthropic-ai/claude-code</code
>
</li>
<li>
或者配置 npm 使用用户目录:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>npm config set prefix ~/.npm-global</code
>
</li>
<li>
然后添加到 PATH:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>export PATH=~/.npm-global/bin:$PATH</code
>
</li>
</ul>
</div>
</details>
<details
class="rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800"
>
<summary
class="cursor-pointer p-3 text-sm font-medium text-gray-800 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4 sm:text-base"
>
缺少依赖库
</summary>
<div class="px-3 pb-3 text-gray-600 dark:text-gray-400 sm:px-4 sm:pb-4">
<p class="mb-2">某些 Linux 发行版需要安装额外依赖:</p>
<div
class="overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"
>
<div class="mb-2"># Ubuntu/Debian</div>
<div class="whitespace-nowrap text-gray-300">
sudo apt install build-essential
</div>
<div class="mb-2 mt-2"># CentOS/RHEL</div>
<div class="whitespace-nowrap text-gray-300">
sudo dnf groupinstall "Development Tools"
</div>
</div>
</div>
</details>
<details
class="rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800"
>
<summary
class="cursor-pointer p-3 text-sm font-medium text-gray-800 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4 sm:text-base"
>
环境变量不生效
</summary>
<div class="px-3 pb-3 text-gray-600 dark:text-gray-400 sm:px-4 sm:pb-4">
<p class="mb-2">检查以下几点:</p>
<ul class="list-inside list-disc space-y-1 text-sm">
<li>确认修改了正确的配置文件(.bashrc 或 .zshrc)</li>
<li>
重新启动终端或运行
<code class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>source ~/.bashrc</code
>
</li>
<li>
验证设置:<code
class="rounded bg-gray-200 px-1 text-xs dark:bg-gray-700 sm:text-sm"
>echo $ANTHROPIC_BASE_URL</code
>
</li>
</ul>
</div>
</details>
</div>
</div>
</div>
<!-- 结尾 -->
<div
class="rounded-xl bg-gradient-to-r from-blue-500 to-purple-600 p-4 text-center text-white sm:p-6"
>
<h5 class="mb-2 text-lg font-semibold sm:text-xl">🎉 恭喜你!</h5>
<p class="mb-3 text-sm text-blue-100 sm:mb-4 sm:text-base">
你已经成功安装并配置了 Claude Code,现在可以开始享受 AI 编程助手带来的便利了。
</p>
<p class="text-xs text-blue-200 sm:text-sm">
如果在使用过程中遇到任何问题,可以查看官方文档或社区讨论获取帮助。
</p>
</div>
</div>
</div>
</template>
<script setup>
import { computed, ref } from 'vue'
// 当前系统选择
const activeTutorialSystem = ref('windows')
// 系统列表
const tutorialSystems = [
{ key: 'windows', name: 'Windows', icon: 'fab fa-windows' },
{ key: 'macos', name: 'macOS', icon: 'fab fa-apple' },
{ key: 'linux', name: 'Linux / WSL2', icon: 'fab fa-linux' }
]
// 获取基础URL前缀
const getBaseUrlPrefix = () => {
// 优先使用环境变量配置的自定义前缀
const customPrefix = import.meta.env.VITE_API_BASE_PREFIX
if (customPrefix) {
// 去除末尾的斜杠
return customPrefix.replace(/\/$/, '')
}
// 否则使用当前浏览器访问地址
// 更健壮的获取 origin 的方法,兼容旧版浏览器和特殊环境
let origin = ''
if (window.location.origin) {
// 现代浏览器直接支持 origin
origin = window.location.origin
} else {
// 旧版浏览器或特殊环境的兼容处理
const protocol = window.location.protocol
const hostname = window.location.hostname
const port = window.location.port
origin = protocol + '//' + hostname
// 只有在非默认端口时才添加端口号
if (
port &&
((protocol === 'http:' && port !== '80') || (protocol === 'https:' && port !== '443'))
) {
origin += ':' + port
}
}
// 如果还是获取不到,使用当前页面的 URL 推导
if (!origin) {
const currentUrl = window.location.href
const pathStart = currentUrl.indexOf('/', 8) // 跳过 http:// 或 https://
if (pathStart !== -1) {
origin = currentUrl.substring(0, pathStart)
} else {
// 最后的降级方案,使用相对路径
return ''
}
}
return origin
}
// 当前基础URL - Claude Code
const currentBaseUrl = computed(() => {
return getBaseUrlPrefix() + '/api'
})
// Gemini CLI 基础URL
const geminiBaseUrl = computed(() => {
return getBaseUrlPrefix() + '/gemini'
})
// OpenAI/Codex 基础URL
const openaiBaseUrl = computed(() => {
return getBaseUrlPrefix() + '/openai'
})
// Droid 类型账号基础URL
const droidClaudeBaseUrl = computed(() => {
return getBaseUrlPrefix() + '/droid/claude'
})
const droidOpenaiBaseUrl = computed(() => {
return getBaseUrlPrefix() + '/droid/openai'
})
// Codex 配置内容
const codexConfigContent = computed(() => {
// 根据当前激活的教程系统获取对应的环境变量设置说明
const getCurrentPlatformAuthInstructions = () => {
const baseInstructions = {
title: '环境变量设置方法',
description:
'💡 将 OPENAI_API_KEY 设置为 null,然后设置环境变量 CRS_OAI_KEY 为您的 API 密钥(格式如 cr_xxxxxxxxxx)。'
}
switch (activeTutorialSystem.value) {
case 'windows':
return {
...baseInstructions,
platform: {
title: 'Windows',
command: 'set CRS_OAI_KEY=cr_xxxxxxxxxx'
}
}
case 'macos':
return {
...baseInstructions,
platform: {
title: 'macOS',
command: 'export CRS_OAI_KEY=cr_xxxxxxxxxx'
},
persistent: {
title: 'Shell 配置文件(持久保存)',
description: '添加到您的 shell 配置文件中:',
commands: [
'# 对于 zsh (默认)',
'echo "export CRS_OAI_KEY=cr_xxxxxxxxxx" >> ~/.zshrc',
'source ~/.zshrc',
'',
'# 对于 bash',
'echo "export CRS_OAI_KEY=cr_xxxxxxxxxx" >> ~/.bash_profile',
'source ~/.bash_profile'
]
}
}
case 'linux':
return {
...baseInstructions,
platform: {
title: 'Linux',
command: 'export CRS_OAI_KEY=cr_xxxxxxxxxx'
},
persistent: {
title: 'Shell 配置文件(持久保存)',
description: '添加到您的 shell 配置文件中:',
commands: [
'# 对于 bash (默认)',
'echo "export CRS_OAI_KEY=cr_xxxxxxxxxx" >> ~/.bashrc',
'source ~/.bashrc',
'',
'# 对于 zsh',
'echo "export CRS_OAI_KEY=cr_xxxxxxxxxx" >> ~/.zshrc',
'source ~/.zshrc'
]
}
}
default:
return baseInstructions
}
}
return {
configToml: [
'model_provider = "crs"',
'model = "gpt-5-codex"',
'model_reasoning_effort = "high"',
'disable_response_storage = true',
'preferred_auth_method = "apikey"',
'',
'[model_providers.crs]',
'name = "crs"',
`base_url = "${openaiBaseUrl.value}"`,
'wire_api = "responses"',
'requires_openai_auth = true',
'env_key = "CRS_OAI_KEY"'
],
authJson: ['{', ' "OPENAI_API_KEY": null', '}'],
authInstructions: getCurrentPlatformAuthInstructions()
}
})
// Droid CLI 配置示例
const droidCliConfigLines = computed(() => [
'{',
' "custom_models": [',
' {',
' "model_display_name": "Sonnet 4.5 [crs]",',
' "model": "claude-sonnet-4-5-20250929",',
` "base_url": "${droidClaudeBaseUrl.value}",`,
' "api_key": "你的API密钥",',
' "provider": "anthropic",',
' "max_tokens": 8192',
' },',
' {',
' "model_display_name": "GPT5-Codex [crs]",',
' "model": "gpt-5-codex",',
` "base_url": "${droidOpenaiBaseUrl.value}",`,
' "api_key": "你的API密钥",',
' "provider": "openai",',
' "max_tokens": 16384',
' }',
' ]',
'}'
])
</script>
<style scoped>
.tutorial-container {
min-height: calc(100vh - 300px);
}
.tutorial-content {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
code {
font-family: 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}
.tutorial-content h4 {
scroll-margin-top: 100px;
}
.tutorial-content .bg-gradient-to-r {
transition: all 0.2s ease;
}
.tutorial-content .bg-gradient-to-r:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
/* 暗色主题优化 */
/* 顶部标签栏背景 - 增加深度感 */
html.dark :deep(.bg-gray-100) {
background-color: #1f2937 !important;
border: 1px solid rgba(75, 85, 99, 0.5);
}
html.dark :deep(.bg-gray-700) {
background-color: #1a202c !important;
border: 1px solid rgba(75, 85, 99, 0.6);
}
/* 活动标签页 - 更明显的对比和高亮 */
html.dark :deep(button.bg-gray-800) {
background-color: #3b82f6 !important;
border: 1px solid rgba(59, 130, 246, 0.8);
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
color: #ffffff !important;
}
/* 非活动标签页文字颜色优化 */
html.dark :deep(button:not(.bg-gray-800).text-gray-600) {
color: #9ca3af !important;
}
html.dark :deep(button:not(.bg-gray-800).hover\:text-gray-900:hover) {
color: #d1d5db !important;
}
/* 代码块 - 减少纯黑,增加层次感 */
html.dark :deep(.bg-gray-900) {
background-color: #1e293b !important;
border: 1px solid rgba(71, 85, 105, 0.6);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
/* 优化链接颜色 - 更亮更突出 */
html.dark :deep(a) {
color: #60a5fa !important;
text-decoration: underline;
}
html.dark :deep(a:hover) {
color: #93c5fd !important;
}
/* 行内代码样式优化 */
html.dark :deep(code.rounded) {
background-color: #334155 !important;
border: 1px solid rgba(100, 116, 139, 0.6);
color: #fbbf24 !important;
padding: 0.125rem 0.375rem;
}
/* 注意事项框 - 蓝色系列 */
html.dark :deep(.border-blue-200) {
border-color: rgba(59, 130, 246, 0.5) !important;
}
html.dark :deep(.bg-blue-50) {
background-color: rgba(37, 99, 235, 0.15) !important;
border: 1px solid rgba(59, 130, 246, 0.3);
}
/* 成功提示框 - 绿色系列 */
html.dark :deep(.border-green-200) {
border-color: rgba(34, 197, 94, 0.5) !important;
}
html.dark :deep(.bg-green-50) {
background-color: rgba(34, 197, 94, 0.15) !important;
border: 1px solid rgba(34, 197, 94, 0.3);
}
/* 警告提示框 - 黄色系列 */
html.dark :deep(.border-yellow-200) {
border-color: rgba(250, 204, 21, 0.5) !important;
}
html.dark :deep(.bg-yellow-50) {
background-color: rgba(250, 204, 21, 0.15) !important;
border: 1px solid rgba(250, 204, 21, 0.3);
}
/* Indigo 提示框 */
html.dark :deep(.border-indigo-200) {
border-color: rgba(99, 102, 241, 0.5) !important;
}
html.dark :deep(.bg-indigo-50) {
background-color: rgba(99, 102, 241, 0.15) !important;
border: 1px solid rgba(99, 102, 241, 0.3);
}
/* Purple 提示框 */
html.dark :deep(.border-purple-200) {
border-color: rgba(168, 85, 247, 0.5) !important;
}
/* 渐变背景优化 */
html.dark :deep(.from-purple-50) {
background: linear-gradient(
to right,
rgba(168, 85, 247, 0.15),
rgba(236, 72, 153, 0.15)
) !important;
border: 1px solid rgba(168, 85, 247, 0.3);
}
html.dark :deep(.from-blue-50) {
background: linear-gradient(
to right,
rgba(59, 130, 246, 0.15),
rgba(99, 102, 241, 0.15)
) !important;
border: 1px solid rgba(59, 130, 246, 0.3);
}
html.dark :deep(.from-green-50) {
background: linear-gradient(
to right,
rgba(34, 197, 94, 0.15),
rgba(16, 185, 129, 0.15)
) !important;
border: 1px solid rgba(34, 197, 94, 0.3);
}
/* 文字对比度优化 - 提高可读性 */
html.dark :deep(.text-gray-400) {
color: #9ca3af !important;
}
html.dark :deep(.text-gray-600) {
color: #d1d5db !important;
}
html.dark :deep(.text-gray-700) {
color: #e5e7eb !important;
}
html.dark :deep(.text-gray-800) {
color: #f3f4f6 !important;
}
/* 彩色文字优化 - 提高亮度 */
html.dark :deep(.text-blue-600) {
color: #60a5fa !important;
}
html.dark :deep(.text-blue-700) {
color: #60a5fa !important;
}
html.dark :deep(.text-blue-800) {
color: #93c5fd !important;
}
html.dark :deep(.text-green-700) {
color: #4ade80 !important;
}
html.dark :deep(.text-green-800) {
color: #86efac !important;
}
html.dark :deep(.text-yellow-700) {
color: #facc15 !important;
}
html.dark :deep(.text-yellow-800) {
color: #fde047 !important;
}
html.dark :deep(.text-indigo-700) {
color: #818cf8 !important;
}
html.dark :deep(.text-indigo-800) {
color: #a5b4fc !important;
}
/* 标题对比度优化 */
html.dark :deep(h3),
html.dark :deep(h4),
html.dark :deep(h5),
html.dark :deep(h6) {
color: #f9fafb !important;
}
/* 内嵌背景色优化 */
html.dark :deep(.bg-yellow-100) {
background-color: rgba(250, 204, 21, 0.2) !important;
}
html.dark :deep(.bg-indigo-100) {
background-color: rgba(99, 102, 241, 0.2) !important;
}
/* 白色背景框体优化 - 选中的标签页 */
html.dark :deep(.bg-white) {
background-color: #374151 !important;
border: 1px solid rgba(107, 114, 128, 0.5);
}
/* 边框颜色统一优化 */
html.dark :deep(.border-purple-700) {
border-color: rgba(168, 85, 247, 0.6) !important;
}
html.dark :deep(.border-blue-100) {
border-color: rgba(59, 130, 246, 0.4) !important;
}
html.dark :deep(.border-green-100) {
border-color: rgba(34, 197, 94, 0.4) !important;
}
html.dark :deep(.border-purple-100) {
border-color: rgba(168, 85, 247, 0.4) !important;
}
/* 代码块内文字颜色优化 */
html.dark :deep(.text-green-400) {
color: #4ade80 !important;
}
html.dark :deep(.text-gray-300) {
color: #d1d5db !important;
}
</style>
|