【问题标题】:Why won't my React Native app run on my device为什么我的 React Native 应用程序无法在我的设备上运行
【发布时间】:2017-06-17 16:34:21
【问题描述】:

我希望能够在 Expo 上测试我的应用程序(一个用于在您点击保存后测试 React Native 代码的 iPhone 应用程序),但我似乎无法克服这个错误,我收到了 Terminal .我之前使用Expo 运行我的应用程序没有任何问题,但现在尝试在我的应用程序中包含导航器后,我收到错误消息。

首先我是这样做的:

$ npm i -g create-react-native-app
$ create-react-native-app my-project
$ cd my-project`

然后我想在我的应用程序中包含一个导航器,所以我继续这样做:

npm install --save react-navigation

在那之后,为了让Expo 运行,我做了:

npm start

当我执行npm start 时,我在Terminal 中收到此错误:

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! Mestro@0.1.0 start: `react-native-scripts start`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the Mestro@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

【问题讨论】:

  • 是否安装了react-native-scripts
  • @vijayst 我不这么认为。我该怎么做呢?
  • npm i react-native-scripts
  • @vijayst k,我会尝试并告诉你会发生什么。
  • @vijayst 好的,所以我做了npm i react-native-scripts,它成功了。然后我做了npm start,又给我一个错误。

标签: javascript ios react-native terminal expo


【解决方案1】:

我的猜测是您使用的是 npm5,我建议您使用 npm4,npm5 目前(截至 2017 年 6 月 17 日)非常有问题。 see this recommendation in the README.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-17
    • 2021-09-19
    • 2020-05-06
    • 1970-01-01
    • 2021-08-07
    • 2018-05-20
    • 1970-01-01
    相关资源
    最近更新 更多