react-native 0.57.1 bundle fails trying to assign a value to read only property 'undefined'

524 Views Asked by At

When releasing a CodePush release, I am running into this issue.

$ appcenter codepush release-react \
  --deployment-name=Staging \
  --token=$APPCENTER_ACCESS_TOKEN \
  --description "$(git show -q)" \
  --disable-duplicate-release-error \
  --app=$APP_NAME

| Getting app info.../ Getting app info...- Getting app info...\ Getting app info...| Getting app info...Detecting android app version:

Using the target binary version value "0.0.1" from "android/app/build.gradle".

Running "react-native bundle" command:

node node_modules/react-native/local-cli/cli.js bundle --assets-dest /tmp/code-push11899-237-hv244s.pd3u/CodePush --bundle-output /tmp/code-push11899-237-hv244s.pd3u/CodePush/index.android.bundle --dev false --entry-file index.js --platform android

Cannot assign to read only property 'undefined' of object '#<Object>'
TypeError: Cannot assign to read only property 'undefined' of object '#<Object>'
    at buildBundle$ (/home/circleci/repo/node_modules/react-native/local-cli/bundle/buildBundle.js:39:10)
    at tryCatch (/home/circleci/repo/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/home/circleci/repo/node_modules/regenerator-runtime/runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (/home/circleci/repo/node_modules/regenerator-runtime/runtime.js:114:21)
    at tryCatch (/home/circleci/repo/node_modules/regenerator-runtime/runtime.js:62:40)
    at invoke (/home/circleci/repo/node_modules/regenerator-runtime/runtime.js:152:20)
    at /home/circleci/repo/node_modules/regenerator-runtime/runtime.js:187:11
    at new Promise (<anonymous>)
    at callInvokeWithMethodAndArg (/home/circleci/repo/node_modules/regenerator-runtime/runtime.js:186:16)
    at AsyncIterator.enqueue [as _invoke] (/home/circleci/repo/node_modules/regenerator-runtime/runtime.js:209:13)

Error: Failed to release a CodePush update.
Exited with code 3

I have explored a bit, but the mentioned line seems to point to https://github.com/facebook/react-native/blob/master/local-cli/bundle/buildBundle.js#L39 which is a simple NODE_ENV overwrite:

  process.env.NODE_ENV = args.dev ? 'development' : 'production';

Do you have any idea where that issue is coming from?

Here is more information:

node:8.10
yarn install v1.5.1
[email protected]
"react-native": "0.57.1",
"react-native-code-push": "^5.4.0",

Update

I have narrowed it down to the following command failing:

./node_modules/.bin/react-native bundle --platform android --dev false --reset-cache --entry-file index.js --bundle-output ./android/app/build/generated/assets/react/release/index.android.bundle --assets-dest ./android/app/build/generated/res/react/release

    Cannot assign to read only property 'undefined' of object '#<Object>'

TypeError: Cannot assign to read only property 'undefined' of object '#<Object>'
    at buildBundle$ (/Users/chanto/Apps/mobile-app/node_modules/react-native/local-cli/bundle/buildBundle.js:39:10)
    at tryCatch (/Users/chanto/Apps/mobile-app/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/Users/chanto/Apps/mobile-app/node_modules/regenerator-runtime/runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/chanto/Apps/mobile-app/node_modules/regenerator-runtime/runtime.js:114:21)
    at tryCatch (/Users/chanto/Apps/mobile-app/node_modules/regenerator-runtime/runtime.js:62:40)
    at invoke (/Users/chanto/Apps/mobile-app/node_modules/regenerator-runtime/runtime.js:152:20)
    at /Users/chanto/Apps/mobile-app/node_modules/regenerator-runtime/runtime.js:187:11
    at new Promise (<anonymous>)
    at callInvokeWithMethodAndArg (/Users/chanto/Apps/mobile-app/node_modules/regenerator-runtime/runtime.js:186:16)
    at AsyncIterator.enqueue [as _invoke] (/Users/chanto/Apps/mobile-app/node_modules/regenerator-runtime/runtime.js:209:13)
1

There are 1 best solutions below

0
On BEST ANSWER

Upgrading to react-native 0.57.2 solved my issue.

#wonderfulbump