最新消息:20190529 VPS服务器已从腾讯云香港换为Vultr新加坡,主题仍用朋友推荐的大前端D8

【已解决】npm install react-native-elements出错:[server error] Cannot load the stats for react-native-elements – please try again later

npm crifan 997浏览 0评论

折腾:

【已解决】ReactNative中使用icon图标

期间,试了2次结果都是出错:

➜  rn_rse npm install react-native-elements
> react-native-elements@0.17.0 postinstall /Users/crifan/dev/dev_root/xxxnode_modules/react-native-elements
> opencollective postinstall
[server error] Cannot load the stats for react-native-elements – please try again later
                               .,,,..        .,,,,.
                              ;;,..,::,.  .,::,..,;:
                             ,r.     .,;::;,      .r.
                             :;       .;;;:       .r,
                             ,r.     ,;:..:;,     .r.
                            .,r;:::;;;;::::;;;;:::;r.
                        .,:::,:r,.,;:        :;,.:r:,:::,
                       :;,.    :;,;,  .:;;:.  ,;,;:    .:;,
                      :;       .;r,  .rrrrr;.  :r;       .;,
                      ,;,      .;;:  .;rrrr;   ;;;.      ,;.
                       .:::.. .;:.;:   .,,.  .;:.:;  .,:::.
                          .,::;r:,,r;…….,;;,,:r;::,.
                             .r,..,,:;;::::r;:,,..:r.
                             ,;      .:;.,;:.     .r,
                             :;        :rr:       .r,
                             .r.    .,::.,::,.    ,r.
                              ,;:::::,.    .,:::::;.
                                …            …
                  Thanks for installing react-native-elements 🙏
                 Please consider donating to our open collective
                        to help us maintain this package.
rn_rse@0.1.0 /Users/crifan/dev/dev_root/daryun/Projects/上汽大众/斯柯达/卓越零售 RSE/新版RSE/sourcecode/react_native/rn_rse/rn_rse
└── react-native-elements@0.17.0
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/@expo/vector-icons/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/babel-preset-es2015-node/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/create-react-class/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/envinfo/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/fbjs-scripts/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/find-babel-config/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/jest-cli/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/lottie-react-native/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/metro-bundler/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/node-pre-gyp/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-branch/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-gesture-handler/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-maps/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-safe-module/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/react-native-svg/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/regexpu-core/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/tar-pack/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/win-release/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/xcode/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/fbjs-scripts/node_modules/cross-spawn/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/metro-bundler/node_modules/fbjs/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/metro-bundler/node_modules/jest-haste-map/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/node-pre-gyp/node_modules/http-signature/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/crifan/dev/dev_root/xxxnode_modules/node-pre-gyp/node_modules/request/package.json’
npm WARN react-native-branch@2.0.0-beta.3 requires a peer of react@>=15.4.0 but none was installed.
npm WARN react-native-gesture-handler@1.0.0-alpha.22 requires a peer of react@> 15.0.0 but none was installed.
npm WARN react-native-elements@0.17.0 requires a peer of react-native-vector-icons@^4.2.0 but none was installed.
   ╭─────────────────────────────────────╮
   │                                     │
   │   Update available 4.6.1 → 5.4.2    │
   │     Run npm i -g npm to update      │
   │                                     │
   ╰─────────────────────────────────────╯

[server error] Cannot load the stats for react-native-elements – please try again later

npm install failed:[server error] Cannot load the stats for react-native-camera · Issue #807 · lwansbrough/react-native-camera

人家换yarn后就可以了。

About install react-native-elements · Issue #509 · oblador/react-native-vector-icons

Error after importing react-native-elements · Issue #329 · react-native-training/react-native-elements

人家说是最新的v0.11.2就解决了?

此处最新的是0.17.0,出错的。

去换为旧版本,比如0.16.0试试

npm install react-native-elements@0.16.0

问题依旧。

再去之前某个版本

npm install react-native-elements@0.12.0

问题依旧。

参考官网:

react-native-elements/using-with-crna-or-expo.md at master · react-native-training/react-native-elements

去看看如何安装

就是这样安装的啊。

试试直接:

yarn add react-native-elements

看看能否使用。

结果网络好像很慢:

➜  rn_rse yarn add react-native-elements
yarn add v0.21.3
[1/4] 🔍  Resolving packages…
warning There appears to be trouble with your network connection. Retrying…
warning There appears to be trouble with your network connection. Retrying…
[2/4] 🚚  Fetching packages…
warning There appears to be trouble with your network connection. Retrying…
████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 939/940

算了,还是先去尝试解决:

【已解决】npm install期间出错:npm WARN enoent ENOENT: no such file or directory, open node_modules/@expo/vector-icons/package.json

但是此处问题还是没有解决。

难道是此处taobao的源中没有react-native-elements?

再试试

yarn add react-native-elements

还是卡在939/940

ss翻墙改为全局代理后,终于继续了:

➜  rn_rse yarn add react-native-elements
yarn add v0.21.3
[1/4] 🔍  Resolving packages…
[2/4] 🚚  Fetching packages…
[3/4] 🔗  Linking dependencies…
warning "react-native-branch@2.0.0-beta.3" has incorrect peer dependency "react@>=15.4.0".
warning "react-native-gesture-handler@1.0.0-alpha.22" has incorrect peer dependency "react@> 15.0.0".
warning "react-native-elements@0.17.0" has unmet peer dependency "react-native-vector-icons@^4.2.0".
[4/4] 📃  Building fresh packages…
success Saved lockfile.
success Saved 25 new dependencies.
├─ ansi-escapes@1.4.0
├─ babel-plugin-transform-define@1.3.0
├─ chalk@1.1.3
├─ clamp@1.0.1
├─ external-editor@2.0.5
├─ hoist-non-react-statics@2.3.1
├─ immutable@3.8.2
├─ lodash.isempty@4.4.0
├─ lodash.times@4.3.2
├─ lodash@4.17.4
├─ minimist@1.2.0
├─ opencollective@1.0.3
├─ opn@4.0.2
├─ path-to-regexp@1.7.0
├─ react-native-dismiss-keyboard@1.0.0
├─ react-native-drawer-layout-polyfill@1.3.2
├─ react-native-drawer-layout@1.3.2
├─ react-native-elements@0.17.0
├─ react-native-side-menu@1.1.3
├─ react-native-tab-navigator@0.3.4
├─ react-native-tab-view@0.0.69
├─ react-navigation@1.0.0-beta.13
├─ regenerator-runtime@0.10.5
├─ rx@4.1.0
└─ traverse@0.6.6
✨  Done in 45.37s.

npm install [server error] Cannot load the stats for

安装好后,package.json中可以看到:

"react-native-elements": "^0.17.0”,

了。

所以感觉就是:

国内的npm的淘宝的镜像中,找不到react-native-elements

那抽空去:

把npm镜像换成国外的地址:

先去故意卸载:

npm uninstall react-native-elements

➜  rn_rse npm uninstall react-native-elements
– immutable@3.8.2 node_modules/immutable
– lodash.isempty@4.4.0 node_modules/lodash.isempty
– lodash.times@4.3.2 node_modules/lodash.times
– ansi-regex@3.0.0 node_modules/opencollective/node_modules/ansi-regex
– babel-polyfill@6.23.0 node_modules/opencollective/node_modules/babel-polyfill
– is-fullwidth-code-point@2.0.0 node_modules/opencollective/node_modules/is-fullwidth-code-point
– node-fetch@1.6.3 node_modules/opencollective/node_modules/node-fetch
– strip-ansi@4.0.0 node_modules/opencollective/node_modules/string-width/node_modules/strip-ansi
– string-width@2.1.1 node_modules/opencollective/node_modules/string-width
– react-native-side-menu@1.1.3 node_modules/react-native-side-menu
– react-native-tab-navigator@0.3.4 node_modules/react-native-tab-navigator
– rx@4.1.0 node_modules/rx
– inquirer@3.0.6 node_modules/opencollective/node_modules/inquirer
– opencollective@1.0.3 node_modules/opencollective
– react-native-elements@0.17.0 node_modules/react-native-elements
npm WARN react-native-branch@2.0.0-beta.3 requires a peer of react@>=15.4.0 but none was installed.
npm WARN react-native-gesture-handler@1.0.0-alpha.22 requires a peer of react@> 15.0.0 but none was installed.

然后再去:

【已解决】把npm的地址从淘宝镜像换成原始的国外地址

但是没有解决此处的问题。

后来继续折腾:

去换为国外的,再去试试:

npm config set registry https://registry.npmjs.org

npm install react-native-elements

但是刚刚发现

node_modules

中已经有了:

react-native-elements

然后删除掉,再去用国外的源,试试

npm install react-native-elements

结果始终检测不出来

换为淘宝源,试试

npm config set registry https://registry.npm.taobao.org

npm install react-native-elements

至少是检测到,貌似可以正常进行的:

然后终于(不知道为何就可以)正常安装了:

➜  rn_rse npm install react-native-elements
> react-native-elements@0.17.0 postinstall /Users/crifan/dev/dev_root/xxxnode_modules/react-native-elements
> opencollective postinstall
                               .,,,..        .,,,,.
                              ;;,..,::,.  .,::,..,;:
                             ,r.     .,;::;,      .r.
                             :;       .;;;:       .r,
                             ,r.     ,;:..:;,     .r.
                            .,r;:::;;;;::::;;;;:::;r.
                        .,:::,:r,.,;:        :;,.:r:,:::,
                       :;,.    :;,;,  .:;;:.  ,;,;:    .:;,
                      :;       .;r,  .rrrrr;.  :r;       .;,
                      ,;,      .;;:  .;rrrr;   ;;;.      ,;.
                       .:::.. .;:.;:   .,,.  .;:.:;  .,:::.
                          .,::;r:,,r;…….,;;,,:r;::,.
                             .r,..,,:;;::::r;:,,..:r.
                             ,;      .:;.,;:.     .r,
                             :;        :rr:       .r,
                             .r.    .,::.,::,.    ,r.
                              ,;:::::,.    .,:::::;.
                                …            …
                  Thanks for installing react-native-elements 🙏
                 Please consider donating to our open collective
                        to help us maintain this package.
                            Number of contributors: 88
                               Number of backers: 9
                             Annual budget: US$ 1,796
                             Current balance: US$ 751
rn_rse@0.1.0 /Users/crifan/dev/dev_root/xxx
└── react-native-elements@0.17.0
npm WARN react-native-branch@2.0.0-beta.3 requires a peer of react@>=15.4.0 but none was installed.
npm WARN react-native-gesture-handler@1.0.0-alpha.22 requires a peer of react@> 15.0.0 but none was installed.
npm WARN react-native-elements@0.17.0 requires a peer of react-native-vector-icons@^4.2.0 but none was installed.

然后可以看到下载好的

react-native-elements

【总结】

此处,不知道什么原因,最后还是用了淘宝的源,最终正常安装了

npm install react-native-elements

至于怎么解决问题的,暂时不确定,可能:

和上面反复切换淘宝源和官网源,有关系?

【后记】

但是发现package.json中并没有react-native-elements

所以还是有问题,再去试试:

npm install react-native-elements

结果虽然本地node_modules中有了,但是还是package.json中并没有react-native-elements

然后试了试:

npm install react-native-elements —save

虽然出错了:

但是package.json中有react-native-elements了:

所以先不管了。

应该可以继续使用这个react-native-elements库就行了。

至于:

  • npm install react-native-elements后,显示成功,本地node_modules中有react-native-elements,但是还是package.json中并没有react-native-elements

  • 后来npm install react-native-elements –save后,package.json中出现了react-native-elements

的根本原因,抽空再去深究。

转载请注明:在路上 » 【已解决】npm install react-native-elements出错:[server error] Cannot load the stats for react-native-elements – please try again later

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
71 queries in 0.201 seconds, using 18.78MB memory