【问题标题】:react-native 0.57.1 bundle fails trying to assign a value to read only property 'undefined'react-native 0.57.1​​ 捆绑包尝试为只读属性“未定义”分配值失败
【发布时间】:2018-10-09 12:56:07
【问题描述】:

在发布 CodePush 版本时,我遇到了这个问题。

$ 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

我已经探索了一下,但提到的行似乎指向https://github.com/facebook/react-native/blob/master/local-cli/bundle/buildBundle.js#L39,这是一个简单的NODE_ENV 覆盖:

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

你知道这个问题是从哪里来的吗?

这里有更多信息:

node:8.10
yarn install v1.5.1
appcenter-cli@1.1.4
"react-native": "0.57.1",
"react-native-code-push": "^5.4.0",

更新

我已将其范围缩小为以下命令失败:

./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)

【问题讨论】:

    标签: node.js react-native code-push react-native-code-push


    【解决方案1】:

    升级到 react-native 0.57.2 解决了我的问题。

    #wonderfulbump

    【讨论】:

      猜你喜欢
      • 2018-12-26
      • 1970-01-01
      • 2020-07-03
      • 1970-01-01
      • 1970-01-01
      • 2020-10-03
      • 2018-03-27
      • 2019-04-15
      • 2020-01-08
      相关资源
      最近更新 更多