最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

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

npm crifan 3643浏览 0评论

折腾:

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

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

➜  rn_rse npm install react-native-elements
> [email protected] 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.
[email protected] /Users/crifan/dev/dev_root/daryun/Projects/上汽大众/斯柯达/卓越零售 RSE/新版RSE/sourcecode/react_native/rn_rse/rn_rse
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 [email protected] requires a peer of react@>=15.4.0 but none was installed.
npm WARN [email protected] requires a peer of react@> 15.0.0 but none was installed.
npm WARN [email protected] 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 [email protected]

问题依旧。

再去之前某个版本

npm install [email protected]

问题依旧。

参考官网:

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 "[email protected]" has incorrect peer dependency "react@>=15.4.0".
warning "[email protected]" has incorrect peer dependency "react@> 15.0.0".
warning "[email protected]" has unmet peer dependency "react-native-vector-icons@^4.2.0".
[4/4] 📃  Building fresh packages…
success Saved lockfile.
success Saved 25 new dependencies.
✨  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
[email protected] node_modules/immutable
[email protected] node_modules/lodash.isempty
[email protected] node_modules/lodash.times
[email protected] node_modules/opencollective/node_modules/ansi-regex
[email protected] node_modules/opencollective/node_modules/babel-polyfill
[email protected] node_modules/opencollective/node_modules/is-fullwidth-code-point
[email protected] node_modules/opencollective/node_modules/node-fetch
[email protected] node_modules/opencollective/node_modules/string-width/node_modules/strip-ansi
[email protected] node_modules/opencollective/node_modules/string-width
[email protected] node_modules/react-native-side-menu
[email protected] node_modules/react-native-tab-navigator
[email protected] node_modules/rx
[email protected] node_modules/opencollective/node_modules/inquirer
[email protected] node_modules/opencollective
[email protected] node_modules/react-native-elements
npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.
npm WARN [email protected] 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
> [email protected] 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
[email protected] /Users/crifan/dev/dev_root/xxx
npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.
npm WARN [email protected] requires a peer of react@> 15.0.0 but none was installed.
npm WARN [email protected] 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,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.173 seconds, using 22.25MB memory