1

我正在尝试弹出我的应用程序以生成 Android 文件夹。我以前知道它可以工作,但是当我输入react-native eject我的 React Native 项目的根目录时,我得到:

can-mbp:MyApp can$ react-native eject
warn Your project is using deprecated "rnpm" config that will stop working from next release. Please use a "react-native.config.js" file to configure the React Native CLI. Migration guide: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
warn Package "bugsnag-react-native" is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.
warn Package "react-native-onesignal" is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.
warn Package react-native-onesignal has been ignored because it contains invalid configuration. Reason: Unknown option dependency.platforms.ios.sourceDir with value ""./ios"" was found. This is either a typing error or a user mistake. Fixing it will remove this message.
error Unrecognized command "eject".
info Run "react-native --help" to see a list of all available commands.

我已经搜索过它,但每个答案都指出这react-native eject只是正确的形式,我找不到任何关于它不起作用的信息。

这是我来自react-native info命令的系统信息:

 System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
    Memory: 62.21 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.4.0 - /usr/local/bin/node
    Yarn: 1.17.0 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2/10E125 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.0-rc.2 => 0.60.0-rc.2

我究竟做错了什么?

4

3 回答 3

2

Since create-react-native-app is deprecated this functionality is no longer needed.

由于这个公关,它消失了!

就我个人而言,我不喜欢它,但运行npx react-native init YourProjectName并复制必要的内容。

更新: 我复制到删除的代码并制作了一个小包:https ://www.npmjs.com/package/react-native-eject

于 2019-08-03T13:19:45.117 回答
1

一直为我工作,首先安装在你的项目中

yarn add react-native-eject

然后运行

react-native eject

确保你已经在你的电脑上安装了纱线

于 2020-11-23T19:52:38.693 回答
0

键入以下命令 npx react-native 弹出

于 2020-05-05T13:33:20.117 回答