pub 包管理可以建私服吗?


#1

用Flutter开发,需要自己写一些plugin, 可不可以把plugin上传到自己搭建的服务器,而不是pub.dartlang.org。查看了文档https://www.dartlang.org/tools/pub/pubspec#publish_to ,publish_to说可以自定义服务器。但我一直没有部署成功,有这方面的经验的可以提供一个详细的流程吗?非常感谢


#2

可以使用Dart官方提供的pub_server,按照它的readme操作应该就可以 - https://github.com/dart-lang/pub_server


#3

我运行过pub-server 按照提示我出现了一个授权的提示。
Looks great! Are you ready to upload your package (y/n)? y
Pub needs your authorization to upload packages on your behalf.
In a web browser, go to https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&response_type=code&client_id=818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A64124&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email
Then click “Allow access”.

Waiting for your authorization…
我打开浏览器 使用我的google账号登陆提示我 Pub Authorized Successfully。命令行中接收不到授权成功
Waiting for your authorization…
Authorization received, processing…
It looks like accounts.google.com is having some trouble.
Pub will wait for a while before trying to connect again.
OS Error: Operation timed out, errno = 60, address = accounts.google.com, port = 64906
pub finished with exit code 69
然后就退出了, 后面不知道怎么操作了?


#4

确定你的命令行可以访问Google?我本机试过,发布没有问题,但没有弹出说要登录账号,我以前在pub发过包,账号信息可能已经缓存本地了。