美文网首页技术分享React Native开发经验集ReactNative
React Native踩坑笔记(持续更新中...)

React Native踩坑笔记(持续更新中...)

作者: Yao_YongChao | 来源:发表于2017-05-13 23:51 被阅读1514次

           最近发现市场上对React Native开发人员的需求挺多的,自己就想学习一下React Native,多一门技术,好将来买个好价位。嘿嘿!

           在学习React Native中碰到了不少坑,再次记录下来以备自己以后查阅,当然了,也会持续更新。

            只写学习中碰到的问题。至于安装请移步:搭建开发环境,我安装的是React Native0.44

    本人使用的是Ubuntu16.04操作系统,按上面链接中的安装教程安装的,安装过程挺顺利的。没有碰到什么棘手的问题。但是安装成功后,创建项目运行是出问题了。

    1.error calling appregistry.run application

    按教程,cd到目录下,运行:react-nativerun-android,但是运行效果手机一片红,如下:

    原因:是没有启动服务器端。

    答:在Android手机测试之前,要   一定要先

    启动JS服务器端,执行命令:

    react-native start

    命令执行结果:

    上面的问题就解决了。

    2.This warning is caused by a @providesModule declaration with the same name across two different files

    运行react-native start 开始服务器,报一下错误。

    This warning is caused by a @providesModule declaration with the same name across two different files.jest-haste-map: @providesModule naming collision:  Duplicate module name: bser  Paths: /home/yaoyongchao/Ab/node_modules/react-native/node_modules/bser/package.json collides with /home/yaoyongchao/Ab/node_modules/react-native/node_modules/jest-haste-map/node_modules/bser/package.jsonThis warning is caused by a @providesModule declaration with the same name across two different files. ERROR  A non-recoverable condition has triggered.  Watchman needs your help!The triggering condition was at timestamp=1494859938: inotify-add-watch(/home/yaoyongchao/YouDemo/node_modules/fbjs/node_modules/core-js/library/fn/number) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctlAll requests will continue to fail with this message until you resolvethe underlying problem.  You will find more information on fixing this athttps://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch{"watchmanResponse":{"version":"4.7.0","error":"A non-recoverable condition has triggered.  Watchman needs your help!\nThe triggering condition was at timestamp=1494859938: inotify-add-watch(/home/yaoyongchao/YouDemo/node_modules/fbjs/node_modules/core-js/library/fn/number) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl\nAll requests will continue to fail with this message until you resolve\nthe underlying problem.  You will find more information on fixing this at\nhttps://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch\n"}}Error: A non-recoverable condition has triggered.  Watchman needs your help!The triggering condition was at timestamp=1494859938: inotify-add-watch(/home/yaoyongchao/YouDemo/node_modules/fbjs/node_modules/core-js/library/fn/number) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctlAll requests will continue to fail with this message until you resolvethe underlying problem.  You will find more information on fixing this athttps://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch    at ChildProcess.(/home/yaoyongchao/Ab/node_modules/react-native/node_modules/jest-haste-map/node_modules/sane/node_modules/fb-watchman/index.js:207:21)    at emitTwo (events.js:106:13)    at ChildProcess.emit (events.js:191:7)    at maybeClose (internal/child_process.js:886:16)    at Socket.(internal/child_process.js:342:11)

    at emitOne (events.js:96:13)

    at Socket.emit (events.js:188:7)

    at Pipe._handle.close [as _onclose] (net.js:497:12)

    解决:watchman watch-del-all

    rm -rf node_modules && npm install

    rm -fr $TMPDIR/react-*

    npm cache clean

    npm start -- --reset-cache

    解决方案来自:https://medium.com/@jeanjacquesbagui/react-native-providesmodule-naming-collision-error-6bc090925fb3

    3.import React, { Component } from 'react';

    SyntaxError: Unexpected token import

    WebStorm运行react native代码时 报如下错误:

    import React, { Component } from 'react';

    SyntaxError: Unexpected token import

    at createScript (vm.js:56:10)

    at Object.runInThisContext (vm.js:97:10)

    at Module._compile (module.js:542:28)

    at Object.Module._extensions..js (module.js:579:10)

    at Module.load (module.js:487:32)

    at tryModuleLoad (module.js:446:12)

    at Function.Module._load (module.js:438:3)

    at Module.runMain (module.js:604:10)

    at run (bootstrap_node.js:390:7)

    at startup (bootstrap_node.js:150:9)

    原因:没有对WebStorm运行React Native进行配置。

    解决:需要对WebStorm进行配置后,才能运行React Native,参考:http://www.cnblogs.com/shaoting/p/6110202.html

    4.Error running RunR: Please specify npm or yarn package

    原因:没有配置npm或者yarn的路径,

    解决:http://stackoverflow.com/questions/41318944/please-specify-npm-or-yarn-package-in-phpstorm-when-trying-to-install-a-new-np

    5.ERROR  A non-recoverable condition has triggered.  Watchman needs your help!

    终端运行:react-native start 报的错,如下:

    ERROR  A non-recoverable condition has triggered.  Watchman needs your help!The triggering condition was at timestamp=1498047338: inotify-add-watch(/home/yaoyongchao/YouDemo/android/app/build/intermediates/transforms/mergeJniLibs/debug/folders/2000/1f/main/lib/arm64-v8a) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctlAll requests will continue to fail with this message until you resolvethe underlying problem.  You will find more information on fixing this athttps://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch{"watchmanResponse":{"version":"4.7.0","error":"A non-recoverable condition has triggered.  Watchman needs your help!\nThe triggering condition was at timestamp=1498047338: inotify-add-watch(/home/yaoyongchao/YouDemo/android/app/build/intermediates/transforms/mergeJniLibs/debug/folders/2000/1f/main/lib/arm64-v8a) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl\nAll requests will continue to fail with this message until you resolve\nthe underlying problem.  You will find more information on fixing this at\nhttps://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch\n"}}Error: A non-recoverable condition has triggered.  Watchman needs your help!The triggering condition was at timestamp=1498047338: inotify-add-watch(/home/yaoyongchao/YouDemo/android/app/build/intermediates/transforms/mergeJniLibs/debug/folders/2000/1f/main/lib/arm64-v8a) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctlAll requests will continue to fail with this message until you resolvethe underlying problem.  You will find more information on fixing this athttps://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch    at ChildProcess.(/home/yaoyongchao/YouDemo/node_modules/react-native/node_modules/jest-haste-map/node_modules/sane/node_modules/fb-watchman/index.js:207:21)    at emitTwo (events.js:106:13)    at ChildProcess.emit (events.js:191:7)    at maybeClose (internal/child_process.js:886:16)    at Socket.(internal/child_process.js:342:11)

    at emitOne (events.js:96:13)

    at Socket.emit (events.js:188:7)

    at Pipe._handle.close [as _onclose] (net.js:497:12)

    原因:因为inotify默认内核参数值太小。

    解决:

    方案一

    $ sudo sysctl fs.inotify.max_user_watches=524288

    $ watchman shutdown-server

    参考来源

    方案二

    sudo su 

    vim /etc/sysctl.conf

    在文件里面添加**fs.inotify.max_user_watches=16384**(这个是系统默认值到两倍,够用了),:wq保存

    然后运行/sbin/sysctl -p使其立即生效

    使用sysclt -a可以看到fs.inotify.max_user_watches = 16384

    或者直接查看/proc/sys/fs/inotify/max_user_watches这个文件(切勿直接修改这个文件,因为即使你修改了当时生效,等你重启电脑,这个值又会恢复默认)。

    好了,再运行react-native start就OK了

    参考来源

    6.Command `yarn add react-native --exact` failed.

    This will walk you through creating a new React Native project in /home/yaoyongchao/ws/rn/raa

    Using yarn v0.27.5

    Installing react-native...

    yarn add v0.27.5

    info No lockfile found.

    [1/4] Resolving packages...

    warning react-native > connect@2.30.2: connect 2.x series is deprecated

    [2/4] Fetching packages...

    warning fsevents@1.1.2: The platform "linux" is incompatible with this module.

    info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.

    error hawk@6.0.2: The engine "node" is incompatible with this module. Expected version ">=4.5.0".

    error Found incompatible module

    info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

    { [Error: Command failed: yarn add react-native --exact]

    error: null,

    cmd: 'yarn add react-native --exact',

    file: '/bin/sh',

    args: [ '/bin/sh', '-c', 'yarn add react-native --exact' ],

    options:

    { stdio: [ [Object], [Object], [Object] ],

    file: '/bin/sh',

    args: [ '/bin/sh', '-c', 'yarn add react-native --exact' ],

    envPairs:

    [ 'XDG_VTNR=7',

    'LC_PAPER=zh_CN.UTF-8',

    'LC_ADDRESS=zh_CN.UTF-8',

    'AS_HOME=/opt/ide/android-studio',

    'XDG_SESSION_ID=c2',

    'XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/yaoyongchao',

    'LC_MONETARY=zh_CN.UTF-8',

    'CLUTTER_IM_MODULE=xim',

    'SESSION=ubuntu',

    'GPG_AGENT_INFO=/home/yaoyongchao/.gnupg/S.gpg-agent:0:1',

    'ANDROID_HOME=/opt/java/android-sdk-linux',

    'TERM=xterm-256color',

    'VTE_VERSION=4205',

    'XDG_MENU_PREFIX=gnome-',

    'SHELL=/bin/bash',

    'QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1',

    'WINDOWID=79691786',

    'LC_NUMERIC=zh_CN.UTF-8',

    'UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1263',

    'GNOME_KEYRING_CONTROL=',

    'GTK_MODULES=gail:atk-bridge:unity-gtk-module',

    'USER=yaoyongchao',

    'LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:',

    'QT_ACCESSIBILITY=1',

    'LC_TELEPHONE=zh_CN.UTF-8',

    'XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0',

    'XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0',

    'SSH_AUTH_SOCK=/run/user/1000/keyring/ssh',

    'SESSION_MANAGER=local/yaoyongchao:@/tmp/.ICE-unix/1482,unix/yaoyongchao:/tmp/.ICE-unix/1482',

    'DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path',

    'XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg',

    'DESKTOP_SESSION=ubuntu',

    'PATH=/home/yaoyongchao/bin:/home/yaoyongchao/.local/bin:/opt/ide/android-studio/bin:/opt/java/android-sdk-linux/tools:/opt/java/android-sdk-linux/platform-tools:/opt/java/jdk1.8.0_144/bin:/opt/java/jdk1.8.0_144/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin',

    'QT_IM_MODULE=fcitx',

    'QT_QPA_PLATFORMTHEME=appmenu-qt5',

    'LC_IDENTIFICATION=zh_CN.UTF-8',

    'XDG_SESSION_TYPE=x11',

    'PWD=/home/yaoyongchao/ws/rn',

    'JOB=dbus',

    'XMODIFIERS=@im=fcitx',

    'JAVA_HOME=/opt/java/jdk1.8.0_144',

    'LANG=zh_CN.UTF-8',

    'GNOME_KEYRING_PID=',

    'GDM_LANG=zh_CN',

    'MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path',

    'LC_MEASUREMENT=zh_CN.UTF-8',

    'COMPIZ_CONFIG_PROFILE=ubuntu',

    'IM_CONFIG_PHASE=1',

    'GDMSESSION=ubuntu',

    'SESSIONTYPE=gnome-session',

    'GTK2_MODULES=overlay-scrollbar',

    'SHLVL=1',

    'HOME=/home/yaoyongchao',

    'XDG_SEAT=seat0',

    'LANGUAGE=zh_CN:zh:en_US:en',

    'GNOME_DESKTOP_SESSION_ID=this-is-deprecated',

    'XDG_SESSION_DESKTOP=ubuntu',

    'LOGNAME=yaoyongchao',

    'DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Az44WlzhBc',

    'XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop',

    'CLASSPATH=.:/opt/java/jdk1.8.0_144/lib:/opt/java/jdk1.8.0_144/jre/lib:',

    'QT4_IM_MODULE=fcitx',

    'LESSOPEN=| /usr/bin/lesspipe %s',

    'INSTANCE=',

    'XDG_RUNTIME_DIR=/run/user/1000',

    'DISPLAY=:0',

    'XDG_CURRENT_DESKTOP=Unity',

    'GTK_IM_MODULE=fcitx',

    'LESSCLOSE=/usr/bin/lesspipe %s %s',

    'LC_TIME=zh_CN.UTF-8',

    'LC_NAME=zh_CN.UTF-8',

    'XAUTHORITY=/home/yaoyongchao/.Xauthority',

    '_=/usr/local/bin/react-native' ] },

    envPairs:

    [ 'XDG_VTNR=7',

    'LC_PAPER=zh_CN.UTF-8',

    'LC_ADDRESS=zh_CN.UTF-8',

    'AS_HOME=/opt/ide/android-studio',

    'XDG_SESSION_ID=c2',

    'XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/yaoyongchao',

    'LC_MONETARY=zh_CN.UTF-8',

    'CLUTTER_IM_MODULE=xim',

    'SESSION=ubuntu',

    'GPG_AGENT_INFO=/home/yaoyongchao/.gnupg/S.gpg-agent:0:1',

    'ANDROID_HOME=/opt/java/android-sdk-linux',

    'TERM=xterm-256color',

    'VTE_VERSION=4205',

    'XDG_MENU_PREFIX=gnome-',

    'SHELL=/bin/bash',

    'QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1',

    'WINDOWID=79691786',

    'LC_NUMERIC=zh_CN.UTF-8',

    'UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1263',

    'GNOME_KEYRING_CONTROL=',

    'GTK_MODULES=gail:atk-bridge:unity-gtk-module',

    'USER=yaoyongchao',

    'LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:',

    'QT_ACCESSIBILITY=1',

    'LC_TELEPHONE=zh_CN.UTF-8',

    'XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0',

    'XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0',

    'SSH_AUTH_SOCK=/run/user/1000/keyring/ssh',

    'SESSION_MANAGER=local/yaoyongchao:@/tmp/.ICE-unix/1482,unix/yaoyongchao:/tmp/.ICE-unix/1482',

    'DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path',

    'XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg',

    'DESKTOP_SESSION=ubuntu',

    'PATH=/home/yaoyongchao/bin:/home/yaoyongchao/.local/bin:/opt/ide/android-studio/bin:/opt/java/android-sdk-linux/tools:/opt/java/android-sdk-linux/platform-tools:/opt/java/jdk1.8.0_144/bin:/opt/java/jdk1.8.0_144/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin',

    'QT_IM_MODULE=fcitx',

    'QT_QPA_PLATFORMTHEME=appmenu-qt5',

    'LC_IDENTIFICATION=zh_CN.UTF-8',

    'XDG_SESSION_TYPE=x11',

    'PWD=/home/yaoyongchao/ws/rn',

    'JOB=dbus',

    'XMODIFIERS=@im=fcitx',

    'JAVA_HOME=/opt/java/jdk1.8.0_144',

    'LANG=zh_CN.UTF-8',

    'GNOME_KEYRING_PID=',

    'GDM_LANG=zh_CN',

    'MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path',

    'LC_MEASUREMENT=zh_CN.UTF-8',

    'COMPIZ_CONFIG_PROFILE=ubuntu',

    'IM_CONFIG_PHASE=1',

    'GDMSESSION=ubuntu',

    'SESSIONTYPE=gnome-session',

    'GTK2_MODULES=overlay-scrollbar',

    'SHLVL=1',

    'HOME=/home/yaoyongchao',

    'XDG_SEAT=seat0',

    'LANGUAGE=zh_CN:zh:en_US:en',

    'GNOME_DESKTOP_SESSION_ID=this-is-deprecated',

    'XDG_SESSION_DESKTOP=ubuntu',

    'LOGNAME=yaoyongchao',

    'DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Az44WlzhBc',

    'XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop',

    'CLASSPATH=.:/opt/java/jdk1.8.0_144/lib:/opt/java/jdk1.8.0_144/jre/lib:',

    'QT4_IM_MODULE=fcitx',

    'LESSOPEN=| /usr/bin/lesspipe %s',

    'INSTANCE=',

    'XDG_RUNTIME_DIR=/run/user/1000',

    'DISPLAY=:0',

    'XDG_CURRENT_DESKTOP=Unity',

    'GTK_IM_MODULE=fcitx',

    'LESSCLOSE=/usr/bin/lesspipe %s %s',

    'LC_TIME=zh_CN.UTF-8',

    'LC_NAME=zh_CN.UTF-8',

    'XAUTHORITY=/home/yaoyongchao/.Xauthority',

    '_=/usr/local/bin/react-native' ],

    stderr: null,

    stdout: null,

    pid: 3919,

    output: [ null, null, null ],

    signal: null,

    status: 1 }

    Command `yarn add react-native --exact` failed.

    解决方案:根据日志,升级node到最新的版本,问题解决。

    7.ERROR A non-recoverable condition has triggered.

    ERROR A non-recoverable condition has triggered. Watchman needs your help!

    The triggering condition was at timestamp=1514253347: inotify-add-watch(/home/andy/ws/rn/ODemo) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl

    All requests will continue to fail with this message until you resolve

    the underlying problem.  You will find more information on fixing this at

    https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch

    解决方法:终端输入如下:

    echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events

    echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches

    watchman shutdown-server

    相关文章

      网友评论

        本文标题:React Native踩坑笔记(持续更新中...)

        本文链接:https://www.haomeiwen.com/subject/nsqfxxtx.html