Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.47.1 Build iOS Error #15496

Closed
pohodnya opened this issue Aug 15, 2017 · 25 comments
Closed

0.47.1 Build iOS Error #15496

pohodnya opened this issue Aug 15, 2017 · 25 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@pohodnya
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

  1. react-native -v: 0.47.1
  2. node -v: 8.2.1
  3. npm -v: 5.3.0
  4. yarn --version: 0.20.3

Then, specify:

  • Target Platform: iOS
  • Development Operating System: macOS
  • Build tools: Xcode

Steps to Reproduce

  1. react-native init rn0471_build_ios_release_error_reproduce
  2. open .xcodeproj file
  3. edit scheme -> select "release" build configuration
  4. build & run in simulator

Expected Behavior

The project should be successfully build and run in the simulator

Actual Behavior

The project build failed

+ DEST=/Users/alekseypokhodnya/Library/Developer/Xcode/DerivedData/rn0471reproduce-fdeyxrhuiruhnzgprfosmoijckya/Build/Products/Release-iphonesimulator/rn0471reproduce.app
+ [[ Release = \D\e\b\u\g ]]
+ BUNDLE_FILE=/Users/alekseypokhodnya/Library/Developer/Xcode/DerivedData/rn0471reproduce-fdeyxrhuiruhnzgprfosmoijckya/Build/Products/Release-iphonesimulator/rn0471reproduce.app/main.jsbundle
+ node /Users/alekseypokhodnya/RubymineProjects/rn047-fail-test/rn0471reproduce/node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --reset-cache --bundle-output /Users/alekseypokhodnya/Library/Developer/Xcode/DerivedData/rn0471reproduce-fdeyxrhuiruhnzgprfosmoijckya/Build/Products/Release-iphonesimulator/rn0471reproduce.app/main.jsbundle --assets-dest /Users/alekseypokhodnya/Library/Developer/Xcode/DerivedData/rn0471reproduce-fdeyxrhuiruhnzgprfosmoijckya/Build/Products/Release-iphonesimulator/rn0471reproduce.app
/Users/alekseypokhodnya/RubymineProjects/rn047-fail-test/rn0471reproduce/node_modules/metro-bundler/src/lib/Terminal.js:141
    this._nextStatusStr = util.format(format, ...args);
                                              ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Module._extensions..js (module.js:416:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/alekseypokhodnya/RubymineProjects/rn047-fail-test/rn0471reproduce/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/alekseypokhodnya/RubymineProjects/rn047-fail-test/rn0471reproduce/node_modules/react-native/local-cli/server/runServer.js:18:18)
    at Module._compile (module.js:409:26)
+ [[ false != true ]]
+ [[ ! -f /Users/alekseypokhodnya/Library/Developer/Xcode/DerivedData/rn0471reproduce-fdeyxrhuiruhnzgprfosmoijckya/Build/Products/Release-iphonesimulator/rn0471reproduce.app/main.jsbundle ]]
+ echo 'error: File /Users/alekseypokhodnya/Library/Developer/Xcode/DerivedData/rn0471reproduce-fdeyxrhuiruhnzgprfosmoijckya/Build/Products/Release-iphonesimulator/rn0471reproduce.app/main.jsbundle does not exist. This must be a bug with'
error: File /Users/alekseypokhodnya/Library/Developer/Xcode/DerivedData/rn0471reproduce-fdeyxrhuiruhnzgprfosmoijckya/Build/Products/Release-iphonesimulator/rn0471reproduce.app/main.jsbundle does not exist. This must be a bug with
+ echo 'React Native, please report it here: https://github.com/facebook/react-native/issues'
React Native, please report it here: https://github.com/facebook/react-native/issues
+ exit 2

Reproducible Demo

https://github.com/pohodnya/rn0471_build_ios_release_error_reproduce

@gino8080
Copy link

same problem here

Environment

react-native -v: 0.47.1
node -v: v7.10.1
npm -v: 4.2.0
yarn --version: 0.27.5

@jarecsni
Copy link

Similar issue here:

TransformError: ...../index.ios.js: Unexpected token ) (While processing preset: "..../node_modules/babel-preset-react-native/index.js")

This same exception comes when I try to run react-native-git-upgrade. Something seems to be generally wrong, as this happens on a brand new project.

@amerej
Copy link

amerej commented Aug 16, 2017

TransformError: ../Test/index.ios.js: Unexpected token ) (While processing preset: "../Test/node_modules/babel-preset-react-native/index.js")

RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
UIApplicationMain
main
start
0x0

node 8.4.0
npm 5.3.0

"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.47.1"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "3.0.0",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
}

@rdixonbhw
Copy link

Also failing for me. Running react-native init newproject && cd newproject && react-native run-ios will fail with a TransformError.

  • react-native -v
    react-native-cli: 2.0.1
    react-native: 0.47.1
  • node -v: v6.6.0
  • npm -v: 3.10.3
  • yarn --version: 0.27.5

@esganzerla
Copy link

@jarecsni @amerej @rdixonbhw

This issue is about a syntax error, I am having TransformError as you guys.
Opened another issue about this. #15513

@amerej
Copy link

amerej commented Aug 16, 2017

@esganzerla thank you !

@kamavingah
Copy link

+1

experiencing the same issue on run-android aswell as run-ios

@jarecsni
Copy link

@esganzerla thank you

Any idea around a potential workaround? I'm trying to initialise the project using the new method (expo), maybe that's working and then once it's done I can eject the react native project from it (update soon).

This is really surprising, given it's such a basic scenario (I've just tried to set up a new project :))

@SirVeryBritish
Copy link

SirVeryBritish commented Aug 17, 2017

+1
Came across this last night while trying to set up a new project with react-native init. This problem exists for Android and iOS.

@luco
Copy link

luco commented Aug 17, 2017

+1 on this. Getting the same error as @jarecsni does.

@gino8080
Copy link

+1 deleting the .babelrc sometimes works but its really annoying :(

@rpfaffman
Copy link

deleting trailing comma on line 40 of node_modules/babel-preset-react-native/configs/main.js and re-running react-native run-ios worked for me as a temporary workaround

    [
      'transform-es2015-modules-commonjs',
      {strict: false, allowTopLevelThis: true},
    ],

should be

    [
      'transform-es2015-modules-commonjs',
      {strict: false, allowTopLevelThis: true},
    ]

@SirVeryBritish
Copy link

SirVeryBritish commented Aug 17, 2017

Thanks @rpfaffman Your solution worked. This should be fixed in f69638b.
Try npm update babel-present-react-native to pull the fix.

@gino8080
Copy link

gino8080 commented Aug 18, 2017

@rpfaffman solution works!

can't update using npm update babel-present-react-native

@StevenGreenup
Copy link

+1 I'm tired of seeing a red simulator. I'm new to react-native with a great idea in mind, but it seems I'm stuck until this is fixed.

@gino8080
Copy link

@StevenGreenup you have just to manually edit the file node_modules/babel-preset-react-native/configs/main.js as suggested from @rpfaffman and it works

remove the last coma from

[
      'transform-es2015-modules-commonjs',
      {strict: false, allowTopLevelThis: true},
    ], <---- REMOVE ONLY THIS COMA

@HazAT
Copy link

HazAT commented Aug 21, 2017

So apparently this issue has already been fixed, still if you create a clean project with react-native init it still uses the broken version.
f69638b
Would be really awesome if you can make another release @charpeni @jeanlauliac 3.0.1

@jeanlauliac
Copy link

Ah yes absolutely, I'll release today.

facebook-github-bot pushed a commit that referenced this issue Aug 22, 2017
Summary:
The `3.0.0` contained syntax errors for older versions of Node.

See also #15496

Reviewed By: cpojer

Differential Revision: D5677965

fbshipit-source-id: cae07fdce7e887c6fb1d6087791db8307f6f72f3
@pohodnya
Copy link
Author

Only completely reinstall node in my system helped for me.
See the last comment here: #15410

@sospedra
Copy link

Still broken. Repro:

https://github.com/sospedra/RNAnimated

@HazAT
Copy link

HazAT commented Aug 28, 2017

The latest release 2.0.1 fucks it up again.
That's not an error of babel-preset-react-native though, if you yarn add or npm install it, you get 2.0.1 instead of 3.0.1. I'm not really sure but this seems to be a bug in npm and yarn since I would expect to get 3.0.1 which is the newest semver version instead you get the version with the latest timestamp.
So a new release 3.0.2 should fix it, as a workaround I would go with
yarn remove babel-preset-react-native && yarn add babel-preset-react-native@3.0.1

Prove:
npm info babel-preset-react-native

'3.0.1': '2017-08-22T09:34:48.863Z',
'3.0.2-rc.0': '2017-08-23T20:10:18.259Z',
'2.0.1': '2017-08-25T00:27:59.226Z' 

@jordanmkoncz
Copy link

I had this issue as well when I tried to create an archive in Xcode.

For me, it was because the command to build the JS bundle was failing, and the reason it was failing was because one of my dependencies had a specific babel preset in its .babelrc file, which I did not have installed in my main React Native project's package.json.

In the Xcode error output, a few lines above the "main.jsbundle does not exist" line, I had the following error message from the react-native bundle command that had run:

TransformError: /Users/jordan/Development/MyAppName/node_modules/dotenv-parse-variables/lib/index.js: Unknown plugin "add-module-exports" specified in "/Users/jordan/Development/MyAppName/node_modules/dotenv-parse-variables/.babelrc" at 0, attempted to resolve relative to "/Users/jordan/Development/MyAppName/node_modules/dotenv-parse-variables"

So I installed the missing plugin by running: yarn add --dev babel-plugin-add-module-exports

I then went to Xcode again, did a Product -> Clean, then Product -> Archive, and this time it worked.

I actually used to have these dependency-related babel plugins installed, but I removed them because the release notes for 0.50.0 (https://github.com/facebook/react-native/releases/tag/v0.50.0) stated that this wouldn't be required anymore due to the change in enableBabelRCLookup. But I guess that change isn't quite working correctly, so for now we'll have to keep using the workaround I used here, or the postinstall workaround that they describe in those release notes.

For reference, here's my dependencies:

"react": "16.0.0",
"react-native": "0.50.3"

@Pranit-Harekar
Copy link

It's still broken. I tried this solution but still can't fix it.

    "react-native": "^0.50.0",
    "react": "^16.0.0",
    "node": "v8.7.0"

@jordanmkoncz
Copy link

@Pranit-Harekar what is the error/output you get when you do Product -> Clean then Product -> Archive in Xcode? Or alternatively, when you run the following command:

react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/main.jsbundle --sourcemap-output ios/main.jsbundle.map --assets-dest ios

@petarivanovv9
Copy link

@jordanmkoncz The error is node_modules/react-native/Libraries/react-native/react-native-implementation.js: EISDIR: illegal operation on a directory, read. I'm also having this issue and I can't find a successful solution for me ...

@facebook facebook locked as resolved and limited conversation to collaborators Aug 23, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests