Skip to content
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

还有类似从github上下载的包,没有设置成国内镜像源 #89

Open
djkloop opened this issue Aug 28, 2023 · 2 comments
Open

Comments

@djkloop
Copy link

djkloop commented Aug 28, 2023

# 还有类似从github上下载的包,没有设置成功,看cnpm那个库里面有个专门针对cwebp-bin这种replacehost的方式,

https://github.com/cnpm/binary-mirror-config/blob/master/package.json

image

装完这个库之后的全局npmrc

image

image

用cnpm确实可以安装成功,不知道是怎么替换掉地址的....

image

@yuzhanglong
Copy link

我看cnpm维护了一个map,枚举了常见的二进制资源,https://github.com/cnpm/cnpmcore/blob/c33f10e0ab82e6fa389f968ec2f54ef584fe340e/config/binaries.ts#L601,估计是基于这个map 将链接替换的。

@djkloop
Copy link
Author

djkloop commented Sep 13, 2023

我想起来以前用过这种方法解决了... @yuzhanglong
//
https://juejin.cn/post/6844904008797126669?searchId=20230913100000A5F43E23965DD7326C94
这个作者开发了一个这个库,貌似引用了cnpm的中的一个包解决的
https://github.com/best-shot/bin-wrapper-china
我们项目现在切换到pnpm@7版本,用这个库之后加上以下字段就可以了

"resolutions": {
    "bin-wrapper": "npm:bin-wrapper-china"
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants