React Native踩坑筆記(持續(xù)更新中...)

? ? ? ?最近發(fā)現(xiàn)市場(chǎng)上對(duì)React Native開(kāi)發(fā)人員的需求挺多的,自己就想學(xué)習(xí)一下React Native,多一門(mén)技術(shù),好將來(lái)買(mǎi)個(gè)好價(jià)位。嘿嘿!

? ? ? ?在學(xué)習(xí)React Native中碰到了不少坑,再次記錄下來(lái)以備自己以后查閱,當(dāng)然了,也會(huì)持續(xù)更新。

? ? ? ? 只寫(xiě)學(xué)習(xí)中碰到的問(wèn)題。至于安裝請(qǐng)移步:搭建開(kāi)發(fā)環(huán)境,我安裝的是React Native0.44

本人使用的是Ubuntu16.04操作系統(tǒng),按上面鏈接中的安裝教程安裝的,安裝過(guò)程挺順利的。沒(méi)有碰到什么棘手的問(wèn)題。但是安裝成功后,創(chuàng)建項(xiàng)目運(yùn)行是出問(wèn)題了。

1.error calling appregistry.run application

按教程,cd到目錄下,運(yùn)行:react-nativerun-android,但是運(yùn)行效果手機(jī)一片紅,如下:

原因:是沒(méi)有啟動(dòng)服務(wù)器端。

答:在Android手機(jī)測(cè)試之前,要 ? 一定要先

啟動(dòng)JS服務(wù)器端,執(zhí)行命令:

react-native start

命令執(zhí)行結(jié)果:


上面的問(wèn)題就解決了。

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

運(yùn)行react-native start 開(kāi)始服務(wù)器,報(bào)一下錯(cuò)誤。

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

解決方案來(lái)自:https://medium.com/@jeanjacquesbagui/react-native-providesmodule-naming-collision-error-6bc090925fb3

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

SyntaxError: Unexpected token import

WebStorm運(yùn)行react native代碼時(shí) 報(bào)如下錯(cuò)誤:

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)

原因:沒(méi)有對(duì)WebStorm運(yùn)行React Native進(jìn)行配置。

解決:需要對(duì)WebStorm進(jìn)行配置后,才能運(yùn)行React Native,參考:http://www.cnblogs.com/shaoting/p/6110202.html

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

原因:沒(méi)有配置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!

終端運(yùn)行:react-native start 報(bào)的錯(cuò),如下:

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)

原因:因?yàn)閕notify默認(rèn)內(nèi)核參數(shù)值太小。

解決:

方案一

$ sudo sysctl fs.inotify.max_user_watches=524288

$ watchman shutdown-server

參考來(lái)源

方案二

sudo su?

vim /etc/sysctl.conf

在文件里面添加**fs.inotify.max_user_watches=16384**(這個(gè)是系統(tǒng)默認(rèn)值到兩倍,夠用了),:wq保存

然后運(yùn)行/sbin/sysctl -p使其立即生效

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

或者直接查看/proc/sys/fs/inotify/max_user_watches這個(gè)文件(切勿直接修改這個(gè)文件,因?yàn)榧词鼓阈薷牧水?dāng)時(shí)生效,等你重啟電腦,這個(gè)值又會(huì)恢復(fù)默認(rèn))。

好了,再運(yùn)行react-native start就OK了

參考來(lái)源

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.

解決方案:根據(jù)日志,升級(jí)node到最新的版本,問(wèn)題解決。

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容