react-native-git-upgrade错误:找不到模块'AccessibilityInfo'

时间:2019-01-29 05:41:45

标签: react-native

环境

System:
OS: macOS 10.14.2
CPU: (4) x64 Intel(R) Core(TM) i7-4578U CPU @ 3.00GHz
Memory: 448.52 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.6.0 - ~/.nvm/versions/node/v11.6.0/bin/node
npm: 6.7.0 - ~/.nvm/versions/node/v11.6.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 26, 27, 28
Build Tools: 27.0.3, 28.0.3
System Images: android-24 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5199772
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.57.8 => 0.57.8
npmGlobalPackages:
react-native-git-upgrade: 0.2.7

说明

步骤1。 使用RN版本0.57.8创建一个新项目。

步骤2。 将.babelrc重命名为其他名称(.abelrc)

第3步。 react-native-git-upgrade

第4步。 将.abelrc重命名为.babelrc

第5步。 react-native run-ios

然后终端打印消息:

internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module './bundle/unbundle'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/morton.hsu/ReactNativeProject/testup/node_modules/react-native/local-cli/commands.js:44:1)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Module._compile (/Users/morton.hsu/ReactNativeProject/testup/node_modules/pirates/lib/index.js:83:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Object.newLoader (/Users/morton.hsu/ReactNativeProject/testup/node_modules/pirates/lib/index.js:88:7)
    at Module.load (internal/modules/cjs/loader.js:620:32)
mortonde-Mini:testup morton.hsu$ react-native info
internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module './bundle/unbundle'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/morton.hsu/ReactNativeProject/testup/node_modules/react-native/local-cli/commands.js:44:1)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Module._compile (/Users/morton.hsu/ReactNativeProject/testup/node_modules/pirates/lib/index.js:83:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Object.newLoader (/Users/morton.hsu/ReactNativeProject/testup/node_modules/pirates/lib/index.js:88:7)
    at Module.load (internal/modules/cjs/loader.js:620:32)

如果我仅使用0.58.3或0.57.8创建一个新项目,就可以了。

但是使用react-native-git-upgrade从0.57.8到0.58.3并运行项目会得到错误。

有什么主意吗?预先感谢。

3 个答案:

答案 0 :(得分:6)

昨天我有同样的问题。

我手动修复了它。

从下面的文件。

\node_modules\.cache\@babel\register\.babel.7.2.2.development.json
\node_modules\react-native\node_modules\.cache\@babel\register\.babel.7.2.2.development.json

请删除

require('./bundle/unbundle'),

react-native run-ios

您会得到很好的结果。

答案 1 :(得分:5)

其他方式-并非如此:

rm -r ./node_modules
npm cache clean --force
npm i

=)

答案 2 :(得分:2)

执行

npm ci

足以让我解决问题