React Native Environment Info:
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory: 8.52 GB / 15.95 GB
Binaries:
Yarn: 1.9.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.0 - C:\Program Files\nodejs\npm.CMD
I'm upgrading from React Native 0.56.0.
PS C:\Users\Gary\Documents\code\WonderSwipe> react-native-git-upgrade.cmd 0.57.0-rc.0
git-upgrade info Check for updates
git-upgrade info Using yarn 1.9.4
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.57.0-rc.0, React 16.4.1
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Plugin 0 specified in "C:\\Users\\Gary\\Documents\\code\\WonderSwipe\\node_modules\\babel-preset-react-native\\index.js" provided an invalid property of "default" (While processing preset: "C:\\Users\\Gary\\Documents\\code\\WonderSwipe\\node_modules\\babel-preset-react-native\\index.js")
at Plugin.init (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\plugin.js:131:13)
at Function.normalisePlugin (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:152:12)
at C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:184:30
at Array.map (<anonymous>)
at Function.normalisePlugins (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:158:20)
at OptionManager.mergeOptions (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:234:36)
at C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:265:14
at C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:323:22
at Array.map (<anonymous>)
at OptionManager.resolvePresets (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
git-upgrade ERR! Restore initial sources
Note: checking out 'project-snapshot'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
Run react-native-git-upgrade 0.57.0-rc.0. I can reproduce same error on both Windows and MacOS (latest High Sierra).
I've never encountered a similar breakage with git-upgrade for about the last 10 version of RN upgrades I've done with react-native-git-upgrade.
Ref: https://github.com/react-native-community/react-native-releases/issues/34
confirm. could upgrade by react-native upgrade 0.57.0-rc.0 and manually go through files.
not very successful cause there some other issues. script is bundled, but one time I got error screen about importing static config object from file (defined as module.exports = {...}), now I got message:
Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(/Users/user/project/index.js: ENOENT: no such file or directory, uv_cwd (null))
__38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.248
RCTCxxBridge.mm:429
___ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118
__80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke
-[RCTMultipartStreamReader emitChunk:headers:callback:done:]
-[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:]
-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]
__88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke
__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
-[NSBlockOperation main]
-[__NSOperationInternal _start:]
__NSOQSchedule_f
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_continuation_pop
_dispatch_async_redirect_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread2
_pthread_wqthread
start_wqthread
Have you tried manually upgrading to 0.57?
EDIT: for clarity sake until we release the changelog, to manually upgrade you should need to do these things:
"babel-preset-react-native": "^5", to "metro-react-native-babel-preset": "0.43.5",, then change the .babelrc configuration to:{
"presets": ["module:metro-react-native-babel-preset"]
}
beta.56@kelset I don't think you need to set dependency on the preset anyway, because it's part of Metro dependencies and ends up being in your node modules anyway. Remember that its version has to always match internal Metro version, which may be hard to keep in sync due to lack of peer dependency on RN.
I guess that I've to lock this issue too, apparently it's impossible to avoid disruptive people when trying to fix issues related to release candidates 🤷♂️
I'll keep saying it, it's an open source project. Don't you like something? Fork it and fix it yourself. Writing these kinds of comments is just pathetic.
EDIT: Apparently, the user who posted the disruptive comment deleted it. And yes, I have a screenshot of the comment.
EDIT2: Unlocking, hoping that the conversation will now move towards helpful interactions. And, again, PRs are the first way to move forward this issue.
Tried upgrading the old fashioned way. I first ran yarn add [email protected] without issue, and modified my .babelrc to
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": ["idx"]
}
Then I ran react-native upgrade, and I get
PS C:\Users\Gary\Documents\code\WonderSwipe> react-native upgrade
Scanning folders for symlinks in C:\Users\Gary\Documents\code\WonderSwipe\node_modules (28ms)
(node:16936) UnhandledPromiseRejectionWarning: Error: Cannot find module 'metro/src/blacklist'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\Gary\Documents\code\WonderSwipe\rn-cli.config.js:3:19)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module._compile (C:\Users\Gary\Documents\code\WonderSwipe\node_modules\pirates\lib\index.js:83:24)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.newLoader [as .js] (C:\Users\Gary\Documents\code\WonderSwipe\node_modules\pirates\lib\index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:599:32)
(node:16936) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16936) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Metro still?
PS. output: https://github.com/facebook/react-native/issues/20720#issuecomment-413984074 from yarn add for metro/babel versions upgraded to. Need locking to specific versions instead of latest?
I also face this problem
@fungilation can you copy/paste your package.json if possible?
But yeah that blacklist error seems Metro related.
My package.json
{
"name": "wonderswipe",
"version": "0.0.1",
"private": true,
"eslintConfig": {
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"node": true
},
"plugins": [
"react",
"react-native"
],
"rules": {
"comma-dangle": [
2,
"always-multiline"
],
"semi": [
2,
"never"
],
"react-native/no-unused-styles": 2,
"react-native/split-platform-components": 2
}
},
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"babel-plugin-idx": "^2",
"he": "^1.1.0",
"lodash": "^4.17.2",
"moment": "^2.19.0",
"moment-timezone": "^0.5.10",
"node-summary": "../node-summary",
"react": "16.4.1",
"react-native": "0.57.0-rc.0",
"react-native-actionsheet": "^2.4.2",
"react-native-blur": "^3.2.0",
"react-native-cached-image": "../react-native-cached-image",
"react-native-code-push": "^5.3",
"react-native-custom-tabs": "^0.1.7",
"react-native-easy-toast": "^1.0.9",
"react-native-firebase": "^3.0",
"react-native-fit-image": "^1.4.8",
"react-native-flanimatedimage": "^0.4.0",
"react-native-highlight-words": "^1.0.1",
"react-native-keep-awake": "^3.0.1",
"react-native-linear-gradient": "^2.0.0",
"react-native-modalbox": "^1.6.0",
"react-native-orientation": "^3.1.3",
"react-native-parallax-scroll-view": "../react-native-parallax-scroll-view",
"react-native-rate": "^1.0.8",
"react-native-safari-view": "^2.0.0",
"react-native-sentry": "^0.38.0",
"react-native-sha256": "^1.1.1",
"react-native-status-bar-size": "^0.3.2",
"react-native-swiper": "../react-native-swiper",
"react-native-tooltip": "^5.2.0",
"react-native-tts": "^1.5.0",
"react-native-vector-icons": "^4.1.1",
"react-native-webview-bridge": "../react-native-webview-bridge-RN0.51",
"react-redux": "^5.0.1",
"redux": "^4.0.0",
"redux-thunk": "^2.1.0"
},
"devDependencies": {
"redux-logger": "^3.0.6"
}
}
Uhm so you don't have the "explicit" dependency to metro nor babel? What happens if you add "metro-react-native-babel-preset": "0.43.5", to the deps and
"resolutions": {
"@babel/core": "7.0.0-beta.56",
"babel-core": "7.0.0-bridge.0",
}
To ensure that you are locking at the right versions?
Made those changes and ran yarn. Confirmed that yarn.lock shows babel deps now at 7.0.0-beta.56 instead of 7.0.0-beta.47 before, and metro went from 0.38.3 to 0.43.6. (not 0.43.5, a problem?)
But running react-native upgrade hits the same Error: Cannot find module 'metro/src/blacklist'... as before.
I've done some investigation and the original reported issue is caused by react-native-git-upgrade using still Babel 6 to transpile itself:
Babel by default tries to find .babelrc files to configure itself, and once it finds the one from the RN app (which links to the RN preset that only works on Babel 7) it fails.
The easiest patch to fix this issue is to add babelrc: false to the babel-register method, so Babel does not read any additional .babelrc file.
@fungilation can you give this a try? feel free to send a PR if this fixes the issue 😃
On running
react-native-git-upgrade with babelrc: false
PS C:\Users\Gary\Documents\code\WonderSwipe> node ..\react-native\react-native-git-upgrade\index.js 0.57.0-rc.0
git-upgrade info Check for updates
git-upgrade info Using yarn 1.9.4
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.57.0-rc.0, React 16.4.1
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init temporary Git repository
git-upgrade info Save current .gitignore file
git-upgrade info Add all files to commit
warning: LF will be replaced by CRLF in .babelrc.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/java/com/wonderswipe/MainActivity.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/java/com/wonderswipe/MainApplication.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/res/values/styles.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app.json.
The file will have its original line endings in your working directory.
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade info Add updated files to commit
warning: LF will be replaced by CRLF in .babelrc.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .buckconfig.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .flowconfig.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .gitattributes.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/BUCK.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/build.gradle.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/proguard-rules.pro.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/AndroidManifest.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/java/com/wonderswipe/MainActivity.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/java/com/wonderswipe/MainApplication.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/res/values/strings.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/res/values/styles.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/build.gradle.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/gradle.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/gradle/wrapper/gradle-wrapper.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/gradlew.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/keystores/BUCK.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/keystores/debug.keystore.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/settings.gradle.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe.xcodeproj/xcshareddata/xcschemes/WonderSwipe.xcscheme.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe.xcodeproj/xcshareddata/xcschemes/wonderswipe-tvOS.xcscheme.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/AppDelegate.h.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/AppDelegate.m.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/Base.lproj/LaunchScreen.xib.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/Images.xcassets/AppIcon.appiconset/Contents.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/Images.xcassets/Contents.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/Info.plist.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/main.m.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipeTests/Info.plist.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipeTests/WonderSwipeTests.m.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/wonderswipe-tvOS/Info.plist.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/wonderswipe-tvOSTests/Info.plist.
The file will have its original line endings in your working directory.
git-upgrade info Commit old version template
git-upgrade info Install the new version
warning Resolution field "[email protected]" is incompatible with requested version "babel-core@^6.24.0"
warning Resolution field "[email protected]" is incompatible with requested version "babel-core@^6.7.2"
warning Resolution field "[email protected]" is incompatible with requested version "babel-core@^6.24.1"
warning Resolution field "[email protected]" is incompatible with requested version "babel-core@^6.26.0"
(node:11844) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
warning " > [email protected]" has unmet peer dependency "prop-types@>=15.4.0".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.5.7".
warning " > [email protected]" has unmet peer dependency "fbjs@*".
warning " > [email protected]" has unmet peer dependency "prop-types@*".
warning " > [email protected]" has incorrect peer dependency "react@^15.5.0".
git-upgrade info Generate new version template
git-upgrade info Add updated files to commit
warning: LF will be replaced by CRLF in .babelrc.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .buckconfig.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .flowconfig.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .gitattributes.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/BUCK.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/build.gradle.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/proguard-rules.pro.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/AndroidManifest.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/java/com/wonderswipe/MainActivity.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/java/com/wonderswipe/MainApplication.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/res/values/strings.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/app/src/main/res/values/styles.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/build.gradle.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/gradle.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/gradle/wrapper/gradle-wrapper.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/gradlew.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/keystores/BUCK.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/keystores/debug.keystore.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in android/settings.gradle.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe.xcodeproj/xcshareddata/xcschemes/WonderSwipe.xcscheme.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe.xcodeproj/xcshareddata/xcschemes/wonderswipe-tvOS.xcscheme.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/AppDelegate.h.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/AppDelegate.m.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/Base.lproj/LaunchScreen.xib.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/Images.xcassets/AppIcon.appiconset/Contents.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/Images.xcassets/Contents.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/Info.plist.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipe/main.m.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipeTests/Info.plist.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/WonderSwipeTests/WonderSwipeTests.m.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/wonderswipe-tvOS/Info.plist.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in ios/wonderswipe-tvOSTests/Info.plist.
The file will have its original line endings in your working directory.
git-upgrade info Commit new version template
git-upgrade info Generate the patch between the 2 versions
git-upgrade info Save the patch in temp directory
git-upgrade info Reset the 2 temporary commits
git-upgrade info Apply the patch
error: unrecognized input
git-upgrade WARN The upgrade process succeeded but there might be conflicts to be resolved. See above for the list of files that have merge conflicts. If you don’t see the expected changes, try running:
git apply --reject C:\Users\Gary\AppData\Local\Temp\react-native-git-upgrade\upgrade_0.57.0-rc.0_0.57.0-rc.0.patch
git-upgrade info Upgrade done
Suspicious warnings:
warning Resolution field "[email protected]" is incompatible with requested version "babel-core@^6.24.0"
warning Resolution field "[email protected]" is incompatible with requested version "babel-core@^6.7.2"
warning Resolution field "[email protected]" is incompatible with requested version "babel-core@^6.24.1"
warning Resolution field "[email protected]" is incompatible with requested version "babel-core@^6.26.0"
and
error: unrecognized input
Tried nuking /node_modules/ before running react-native run-android, but hitting Error: Cannot find module 'metro/src/blacklist'... just as before.
So the line change in react-native/react-native-git-upgrade/cli.js looks like fixes react-native-git-upgrade (a hacky temporary fix, or should it permanently ignore .babelrc?), but it's not getting around the Metro error on running anything with react-native. Should this Metro error be a new issue?
> react-native run-android
Scanning folders for symlinks in C:\Users\Gary\Documents\code\WonderSwipe\node_modules (29ms)
(node:21456) UnhandledPromiseRejectionWarning: Error: Cannot find module 'metro/src/blacklist'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\Gary\Documents\code\WonderSwipe\rn-cli.config.js:3:19)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module._compile (C:\Users\Gary\Documents\code\WonderSwipe\node_modules\pirates\lib\index.js:83:24)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.newLoader [as .js] (C:\Users\Gary\Documents\code\WonderSwipe\node_modules\pirates\lib\index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:599:32)
(node:21456) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21456) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
FWIW, @rafeca's fix worked for me. Patched and ran react-native-git-upgrade, resolved merge conflicts, cleaned up with npm uninstall babel-preset-react-native, and I'm good to go (or rather, I've moved on to the next issue, #20712).
Environment
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
Memory: 849.51 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.10.0 - /usr/local/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 5.10.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.3, 27.0.3, 28.0.2
API Levels: 23, 25, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: ^16.4.1 => 16.4.1
react-native: ^0.57.0-rc.0 => 0.57.0-rc.0
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Good to hear, @ngraef would you mind creating a PR with the fix so that it can be merged and cherry-picked for a rc1 release, so that it can be available?
I tried upgrading to react 57 rc by first
yarn add react-native-git-upgrade
Change its cli.js to
require('babel-register')({
presets: [
require('babel-preset-es2015-node'),
require('babel-preset-stage-3')
],
babelrc: false,
// Enable transpiling for react-native-git-upgrade AND the generator, just like the upgrade CLI command does
only: /(react-native-git-upgrade\/(?!(node_modules)))|(local-cli\/generator)/
});
yarn react-native-git-upgrade 0.57.0-rc.0
It does seem to upgrade the node modules to 0.57.0 but the package.json is not updated.
@ngraef did you have to do some additional babel configuration?
https://github.com/facebook/react-native/issues/20712
there is a suggestion fix
const procConfig = {cwd: scriptsDir};
with
const procConfig = {};
Which also "solves" that problem for me. However I get error from
node_modules\react-native\Libraries\Image\Image.android.js: Support for the experimental syntax 'optionalChaining' isn't currently enabled (221:13):
Most helpful comment
I've done some investigation and the original reported issue is caused by
react-native-git-upgradeusing still Babel 6 to transpile itself:https://github.com/facebook/react-native/blob/9c1ea45d38a6ec731894443debe8879fa3876ab7/react-native-git-upgrade/cli.js#L12-L19
Babel by default tries to find
.babelrcfiles to configure itself, and once it finds the one from the RN app (which links to the RN preset that only works on Babel 7) it fails.The easiest patch to fix this issue is to add
babelrc: falseto thebabel-registermethod, so Babel does not read any additional.babelrcfile.@fungilation can you give this a try? feel free to send a PR if this fixes the issue 😃