-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support http proxy when using nuxi init
with node >= 18
#159
Comments
What happens when you run: node -e "require('https').get('https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json')" |
It looks like the same error is reported... |
It seems there is something stopping your node from connecting. Maybe an application firewall? |
That's strange, my application firewall is always off...... any other possible reasons? |
Are you using a proxy? Would you run: env | grep -i proxy
npm config list | grep -i proxy |
Yes, I using proxy on clash.
all_proxy=sock5://127.0.0.1:8889
http_proxy=http://127.0.0.1:8889
https_proxy=http://127.0.0.1:8889
ALL_PROXY=sock5://127.0.0.1:8889 And then |
So the issue is that HTTPS is not working over your HTTP proxy: lovell/sharp#679. We will need to implement a similar fix. |
In fact, it is difficult to access Github and Raw in China, and we often use proxies. However, nuxi seems to be the same as degit, the default tar mode does not use the set proxy. |
npx nuxi init nuxt-app
.nuxi init
In china, I succeeded Just set DNS 114.114.114.114 |
I got the same error. |
Does degit use https_proxy and https_proxy? |
Created issue for |
Landed by unjs/giget#24 |
I'm still having this issue on my windows machine |
@codername-123 Would you try using |
My bad @danielroe it was a problem with my ISP... As soon as I changed my ISP it started working properly |
Glad everything is resolved 😊 |
in china ,I'm failed |
get ip of raw.githubusercontent.com from a web. |
Reopening to investigate more. |
@danielroe So, has it really been solved? I still have this problem, and this issue has been open for more than one year. |
The main issue is native |
when i do a curl to https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json it works however when i do node -e "require('https').get('https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json')" it does not work
Seems Node.js does not use HTTP_PROXY environment variables. See this discussion nodejs/node#8381. To set a global Node.js proxy use https://github.com/gajus/global-agent. I think this is the culprit Possible work around ?? nodejs/undici#1650 (comment) |
Fully agree with you @sumasagrp sadly this is a limitation with Node/undici that lacks built-in Sorry for delay on this. this is still on my todo list to find best workaround. Possibly (also) in lowset level (ofetch) to make proxy support for most of our ecosystem out of the box. |
Bun seems to have support for http_proxy. thanks for all your hard work |
@codingcn Thanks. 114's DNS works for me. BTW, Aliyun's DNS doesn't work, don't try. |
I have the same issue. Besides the usual settings like changing DNS, modifying the hosts file, and using VPN, I've tried everything, but it still doesn't work. |
I have same issue :( |
The best way is actually to give up using it altogether, why hang oneself on one tree? I've already given up. |
Hi all again and sorry for delay on it. I understand for those behind a firewall, it must be a really hard experience and for that, I apologize (I guess on behalf of the lazy Node.js team too haha) it is not supported yet 🙏🏼 I will try to jump at at as soon as possible. |
As a Chinese user, I know the seriousness of this bug, but I don't think it is the right behavior to express one's negative emotions in issues. At the same time, Nuxt is an open source project. Thanks to the Nuxt team for their hard work over the past few years. |
有梯子的方案: Powershell: # 请根据实际情况设置梯子地址
$env:all_proxy="ip:port"
$env:FORCE_NODE_FETCH=1
# 最后执行初始化,请根据实际情况执行
pnpm dlx nuxi@latest init my-app Bash # 同上,请根据实际情况设置梯子地址和初始化命令
export all_proxy="ip:port" && export FORCE_NODE_FETCH=1 && pnpm dlx nuxi@latest init my-app 心路历程: 翻了翻相关的仓库,在 unjs/giget#120 中看到了解决方法 然后捋了一下整个链路 没有细看 node-fetch-native 的代码,只是稍微看了一下文档,应该是逐渐使用node原生实现的fetch来替代之前的node-fetch方案,并且对不支持原生fetch的旧node版本进行了Polyfill (猜的)。所以在有梯子的情况下还是不生效(貌似原生fetch不接受代理)。 没梯子的方案: template = await downloadTemplate(templateName, {
dir: ctx.args.dir,
cwd,
force: Boolean(ctx.args.force),
offline: Boolean(ctx.args.offline),
preferOffline: Boolean(ctx.args.preferOffline),
registry: process.env.NUXI_INIT_REGISTRY || DEFAULT_REGISTRY,
}) 可以通过设置环境变量来更改模板地址 $env:NUXI_INIT_REGISTRY="https://gitee.com/hzgotb/nuxt-starter/raw/templates/templates"
pnpm dlx nuxi@latest init my-app |
Hi. HTTP proxy support for Node.js versions with native fetch added to the latest build of nuxi CLI (read more) If you want to early test, you can try with http_proxy=http://localhost:9080 npx nuxi-nightly@latest init nuxt-app (port |
nuxi init
nuxi init
with node >= 18
me too |
With latest nuxi, http proxy should be supported out of the box! |
it works~ thank you~ |
Hi, the nightly-build works for |
@Milchreis ~> #419 (this will add proxy support to all internal fetches happening with nuxi CLI) (however package managers should still also respect and support |
it did work ,appreciate |
Guide: Resolving nuxi init Error: "Failed to download template from registry" on LinuxSteps to Resolve:
|
Environment
Darwin
v16.17.0
0.0.0
-
unknown
webpack
-
-
-
Reproduction
Not exist
Describe the bug
Additional context
curl https://raw.githubusercontent.com/nuxt/starter/templates/templates/v3.json
Everything works fine when I request the URL directly, I think this might be a bug in nuxt.
Logs
No response
The text was updated successfully, but these errors were encountered: