无法运行 React-Native 项目的 npm start 命令

6

这是我第一次尝试运行react-native项目。我按照React-Native官方文档中的所有说明进行了操作,并执行了'npm start'命令。但在命令提示符中出现以下错误:

     ERROR  watchman--no-pretty get-sockname returned with exit code null dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib
  Referenced from: /usr/local/bin/watchman
  Reason: image not found

Error: watchman--no-pretty get-sockname returned with exit code null dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib
  Referenced from: /usr/local/bin/watchman
  Reason: image not found

    at ChildProcess.<anonymous> (/Users/z013mrq/AwesomeProject/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/index.js:198:18)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:818:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)
1个回答

13

尝试重新安装watchman:

npm r -g watchman 
brew update && brew upgrade
brew install watchman

如果这不能解决问题,尝试查看这里发布的答案

尝试通过以下方式重新安装libtool:

brew reinstall libtool --universal && brew unlink libtool && brew link libtool

如果仍无效,请尝试完全删除并再次尝试上述步骤:

brew uninstall libtool


1
在Linux上遇到同样的问题;不要使用brew,从官方git安装。具体说明请参考Facebook的入门指南 - Toerndev

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接