cli.js require('@ reat-native-community / cli')找不到模块

时间:2019-06-26 19:44:48

标签: react-native

升级到本机v0.59.9。

尝试使用命令Cannot find module '../@react-native-community/cli'构建发行版本时,在/node_modules/react-native/cli.js:12:11接收node node_modules/react-native/cli.js bundle --platform android --dev false --reset-cache --entry-file index.js --bundle-output /var/lib/jenkins/jobs/Build-Deploy-Mobile-App-Android/workspace/src/mobile/Tresta/android/app/build/generated/assets/react/release/index.android.bundle --assets-dest /var/lib/jenkins/jobs/Build-Deploy-Mobile-App-Android/workspace/src/mobile/Tresta/android/app/build/generated/res/react/release

删除了node_modules目录以解决其他问题,并进行了npm安装。

可以在本地执行react-native run-android

该行是var cli = require('@react-native-community/cli');

@ react-native-community在react-native处于同一目录级别。

@ react-native-community / cli目录中没有任何需要加载的内容:

jest.config.js  node_modules  package.json  README.md  setup_env.sh  testSetup.js```

 react-native info
info 
  React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
      Memory: 118.64 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.15.0 - ~/.nvm/versions/node/v8.15.0/bin/node
      npm: 6.9.0 - ~/.nvm/versions/node/v8.15.0/bin/npm
      Watchman: 4.7.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.2, 26.0.1, 27.0.3, 28.0.3
        System Images: android-24 | Google Play Intel x86 Atom, android-25 | Intel x86 Atom_64, android-25 | Google APIs ARM 64 v8a, android-25 | Google APIs Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64
    IDEs:
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.6 => 16.8.6 
      react-native: 0.59.9 => 0.59.9 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native: 0.59.9


1 个答案:

答案 0 :(得分:0)

我的错误。被告知要.gitignore建立目录。显然react-native-community / cli需要其构建目录。