N
Nuxt2mo ago
jude

Unable to Fetch Modules from https://api.nuxt.com/modules in China

Hi everyone, I hope you're doing well! I'm facing an issue while trying to create a Nuxt project using the command pnpm create nuxt@latest. When the process tries to fetch modules from https://api.nuxt.com/modules, it fails with the error: [GET] "https://api.nuxt.com/modules": <no response> fetch failed. I am currently located in China, and I suspect the issue may be related to network restrictions. Here’s what I’ve tried so far: 1. VPN Usage: I’ve confirmed that I can access https://api.nuxt.com/modules through a browser and curl requests when connected to a VPN.
2. Proxy Configuration: I’ve set up the following proxy settings in pnpm:
pnpm config set https-proxy http://127.0.0.1:7890
pnpm config set proxy http://127.0.0.1:7890

pnpm config set https-proxy http://127.0.0.1:7890
pnpm config set proxy http://127.0.0.1:7890

After this, I was able to curl the URL successfully, but the issue still persists when using pnpm create nuxt@latest. 3. Cache and Config Clearing: I cleared the cache with pnpm store prune and reset the configuration multiple times, but the issue still persists. Could anyone guide me on how to bypass this issue, or suggest any potential solutions to make the pnpm command work correctly in China? I would really appreciate any help or advice! Thanks in advance!
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @jude. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I understand your frustration with trying to create a Nuxt project in China. This is a common issue related to network restrictions that many developers face in regions with internet limitations. Based on the knowledge sources, there are a couple of approaches you might try: Alternative Network Connection As you've already discovered, using a VPN helps you access the Nuxt API. One user reported a similar issue when trying to initialize a Nuxt app and found that switching from their Starlink connection to a mobile hotspot resolved the problem GitHub Issue #31059. This confirms that the issue is likely related to network restrictions rather than a problem with Nuxt itself. Proxy API Requests Since you're having trouble specifically with the API calls during project creation, you might need to set up a proper proxy for these requests. While you've set proxy configurations for pnpm, the Nuxt CLI might not be using these settings. There are several strategies for proxying API requests in Nuxt applications as mentioned in a YouTube tutorial Nuxt 3: The BEST way to proxy your API in Nuxt, but for your specific case of project initialization, these would only help after you've created the project. Alternative Approach If you continue to face issues with the pnpm create nuxt@latest command, you might try: 1. Download a starter template manually: Clone a Nuxt starter repository directly from GitHub when you have VPN access. 2. Use a different package manager: Try using npm or yarn with their respective proxy settings. 3. Create the project when connected to VPN: Complete the initial project creation while connected to your VPN, then disconnect for subsequent development if needed. 4. Try offline mode: If you've previously created a Nuxt project, check if your package manager has cached the templates and try using an offline mode. Unfortunately, the knowledge sources don't provide a definitive solution for your specific issue with the pnpm create nuxt@latest command failing in China. This appears to be a networking/access issue rather than a problem with Nuxt itself. If the above suggestions don't work, you might want to reach out directly to the Nuxt community through their GitHub discussions or issues, specifically mentioning the challenges of using Nuxt in regions with network restrictions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@1148427913297924116> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?