在根据 [http://reactnative.cn/docs/0.50/getting-started.html][1]
一文中,搭建了相应的环境,但是运行 react-native init就报错误,错误信息如下:
This will walk you through creating a new React Native project in F:\WebCode\20171114React-nativeDay84\app50
Using yarn v1.3.2
Installing react-native...
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.npm.taobao.org/react-native: tunneling socket could not be established, cause=Hostname/IP doesn't match certificate's altnames: \"Host: registry.npm.taobao.org. is not in the cert's altnames: DNS:github.com, DNS:www.github.com\"".
info If you think this is a bug, please open a bug report with the information provided in "F:\\WebCode\\20171114React-nativeDay84\\app50\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
其大意是证书altnames名字不是github的主机名,请问各位大大,这个有方法可以解决吗,网上找了很久,都没发现又出现过我这种情况的....
问题已解决:
npm 淘宝镜像的问题;做了以下步骤
1.删除yarn 淘宝镜像
2.删除全局的react-native-cli ,yarn
3.重新安装react-native-cli ,yarn
4.删除npm淘宝镜像
坑:按照react-native官网的方式设置了yarn npm的淘宝镜像,然后就出现了这些问题;
删除了淘宝镜像后,原来的vue init webpack也不报错了 原来报错的时 tunneling soceck无法建立;现在可以用了,小开心.买了个代理.npm也可以用了