0

在发布 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)
4

1 回答 1

0

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

#wonderfulbump

于 2018-10-10T09:03:20.417 回答