反应原生的run-ios无法正常工作

时间:2017-09-24 11:41:11

标签: javascript android ios node.js react-native

我正在this lesson

中学习该课程
Versions are:
  npm 5.4.2
  homebrew 1.3.3
  react-native-cli: 2.0.1
  react-native: 0.48.4
  watchman 4.9.0
  node v6.6.0

我已经运行了命令:

admin@admin  ~/Documents/ReactNativeLearning  react-native init albums
This will walk you through creating a new React Native project in /Users/admin/Documents/ReactNativeLearning/albums
Using yarn v1.0.2
Installing react-native...
yarn add v1.0.2
info No lockfile found.
[1/4]   Resolving packages...
warning connect@2.30.2: connect 2.x series is deprecated
[2/4]   Fetching packages...
[3/4]   Linking dependencies...
warning "react-native@0.48.4" has unmet peer dependency "react@16.0.0-alpha.12".
[4/4]   Building fresh packages...
success Saved lockfile.
success Saved 496 new dependencies.

✨  Done in 25.56s.
dyld: lazy symbol binding failed: Symbol not found: _node_module_register
  Referenced from: /Users/admin/node_modules/bufferutil/build/Release/bufferutil.node
  Expected in: flat namespace

dyld: Symbol not found: _node_module_register
  Referenced from: /Users/admin/node_modules/bufferutil/build/Release/bufferutil.node
  Expected in: flat namespace

[1]    12606 abort      react-native init albums
 ✘ admin@admin  ~/Documents/ReactNativeLearning  react-native run-ios
Command `run-ios` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.
 ✘ admin@admin  ~/Documents/ReactNativeLearning  cd albums
 admin@admin  ~/Documents/ReactNativeLearning/albums  react-native run-ios
dyld: lazy symbol binding failed: Symbol not found: _node_module_register
  Referenced from: /Users/admin/node_modules/bufferutil/build/Release/bufferutil.node
  Expected in: flat namespace

dyld: Symbol not found: _node_module_register
  Referenced from: /Users/admin/node_modules/bufferutil/build/Release/bufferutil.node
  Expected in: flat namespace

[1]    12632 abort      react-native run-ios

2 个答案:

答案 0 :(得分:0)

尝试在Project文件夹中执行npm install,然后执行react-native run-ios

答案 1 :(得分:0)

我得知它工作原来我使用的是不同版本的节点(v6.6.0)。所以我安装了nvm,并升级了我的节点。现在它正在工作!

此外,我尝试使用create-react-native-app而不是react-native init。出现了同样的问题。请务必更新所有必需的工具并检查节点版本。