react-native init 项目警告和错误

Posted

技术标签:

【中文标题】react-native init 项目警告和错误【英文标题】:react-native init project warnings and errors 【发布时间】:2018-10-15 18:22:32 【问题描述】:

我总是用原生的方式为 androidios 开发我的项目,但是在很多人跟我谈论 react-native 之后,我决定试一试。

但是,我在最初的第一步感到非常沮丧:创建我的第一个项目。

这是我的环境:

macOS Mojave 10.14 Xcode 10.0 节点 v10.12.0 守望者 4.9.0 react-native-cli: 2.0.1

当我运行命令 react-native init AwesomeProject 时,我看到很多这样的警告:

This will walk you through creating a new React Native project in /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject
    Using yarn v1.10.1
    Installing react-native...
    yarn add v1.10.1
    info No lockfile found.
    [1/4] ????  Resolving packages...
    [2/4] ????  Fetching packages...
    [3/4] ????  Linking dependencies...
    warning "react-native > metro > babel-preset-fbjs > @babel/plugin-check-constants@7.0.0-beta.38" has incorrect peer dependency "@babel/core@7.0.0-beta.38".
    warning " > react-native@0.57.3" has unmet peer dependency "react@16.6.0-alpha.8af6728".
    [4/4] ????  Building fresh packages...
    success Saved lockfile.
    success Saved 427 new dependencies.
    info Direct dependencies
    └─ react-native@0.57.3
    info All dependencies
    ├─ @babel/generator@7.1.3
    ├─ @babel/helper-builder-binary-assignment-operator-visitor@7.1.0
    ├─ @babel/helper-builder-react-jsx@7.0.0
    ├─ @babel/helper-call-delegate@7.1.0
    ├─ @babel/helper-define-map@7.1.0
    ├─ @babel/helper-explode-assignable-expression@7.1.0
    ├─ @babel/helper-hoist-variables@7.0.0
    ├─ @babel/helper-module-transforms@7.1.0
    ├─ @babel/helper-remap-async-to-generator@7.1.0
    ├─ @babel/helper-wrap-function@7.1.0
    ├─ @babel/helpers@7.1.2
    ├─ @babel/highlight@7.0.0
    ├─ @babel/parser@7.1.3
    ├─ @babel/plugin-check-constants@7.0.0-beta.38
    ├─ @babel/plugin-external-helpers@7.0.0
    ├─ @babel/plugin-proposal-export-default-from@7.0.0
    ├─ @babel/plugin-syntax-dynamic-import@7.0.0
    ├─ @babel/plugin-syntax-nullish-coalescing-operator@7.0.0
    ├─ @babel/plugin-syntax-optional-catch-binding@7.0.0
    ├─ @babel/plugin-syntax-optional-chaining@7.0.0
    ├─ @babel/plugin-syntax-typescript@7.0.0
    ├─ @babel/plugin-transform-async-to-generator@7.1.0
    ├─ @babel/plugin-transform-block-scoped-functions@7.0.0
    ├─ @babel/plugin-transform-exponentiation-operator@7.1.0
    ├─ @babel/plugin-transform-member-expression-literals@7.0.0
    ├─ @babel/plugin-transform-object-assign@7.0.0
    ├─ @babel/plugin-transform-object-super@7.1.0
    ├─ @babel/plugin-transform-property-literals@7.0.0
    ├─ @babel/plugin-transform-react-jsx-source@7.0.0
    ├─ @babel/plugin-transform-regenerator@7.0.0
    ├─ @babel/plugin-transform-runtime@7.1.0
    ├─ @babel/plugin-transform-sticky-regex@7.0.0
    ├─ @babel/plugin-transform-typescript@7.1.0
    ├─ @babel/plugin-transform-unicode-regex@7.0.0
    ├─ @babel/register@7.0.0
    ├─ @babel/runtime@7.1.2
    ├─ abbrev@1.1.1
    ├─ accepts@1.3.5
    ├─ ansi-colors@1.1.0
    ├─ ansi-cyan@0.1.1
    ├─ ansi-escapes@3.1.0
    ├─ ansi-gray@0.1.1
    ├─ ansi-red@0.1.1
    ├─ ansi-styles@3.2.1
    ├─ ansi@0.3.1
    ├─ anymatch@2.0.0
    ├─ aproba@1.2.0
    ├─ are-we-there-yet@1.1.5
    ├─ argparse@1.0.10
    ├─ arr-flatten@1.1.0
    ├─ array-filter@0.0.1
    ├─ array-map@0.0.0
    ├─ array-reduce@0.0.0
    ├─ array-slice@0.2.3
    ├─ art@0.10.3
    ├─ asap@2.0.6
    ├─ assign-symbols@1.0.0
    ├─ async-limiter@1.0.0
    ├─ async@2.6.1
    ├─ atob@2.1.2
    ├─ babel-core@6.26.3
    ├─ babel-generator@6.26.1
    ├─ babel-helper-builder-react-jsx@6.26.0
    ├─ babel-helper-call-delegate@6.24.1
    ├─ babel-helper-define-map@6.26.0
    ├─ babel-helper-hoist-variables@6.24.1
    ├─ babel-helpers@6.24.1
    ├─ babel-plugin-check-es2015-constants@6.22.0
    ├─ babel-plugin-syntax-flow@6.18.0
    ├─ babel-plugin-syntax-trailing-function-commas@6.22.0
    ├─ babel-plugin-transform-class-properties@6.24.1
    ├─ babel-plugin-transform-es2015-arrow-functions@6.22.0
    ├─ babel-plugin-transform-es2015-block-scoped-functions@6.22.0
    ├─ babel-plugin-transform-es2015-block-scoping@6.26.0
    ├─ babel-plugin-transform-es2015-classes@6.24.1
    ├─ babel-plugin-transform-es2015-computed-properties@6.24.1
    ├─ babel-plugin-transform-es2015-destructuring@6.23.0
    ├─ babel-plugin-transform-es2015-for-of@6.23.0
    ├─ babel-plugin-transform-es2015-function-name@6.24.1
    ├─ babel-plugin-transform-es2015-literals@6.22.0
    ├─ babel-plugin-transform-es2015-modules-commonjs@6.26.2
    ├─ babel-plugin-transform-es2015-object-super@6.24.1
    ├─ babel-plugin-transform-es2015-parameters@6.24.1
    ├─ babel-plugin-transform-es2015-shorthand-properties@6.24.1
    ├─ babel-plugin-transform-es2015-spread@6.22.0
    ├─ babel-plugin-transform-es2015-template-literals@6.22.0
    ├─ babel-plugin-transform-es3-member-expression-literals@6.22.0
    ├─ babel-plugin-transform-es3-property-literals@6.22.0
    ├─ babel-plugin-transform-flow-strip-types@6.22.0
    ├─ babel-plugin-transform-object-rest-spread@6.26.0
    ├─ babel-plugin-transform-react-display-name@6.25.0
    ├─ babel-plugin-transform-react-jsx@6.24.1
    ├─ babel-plugin-transform-strict-mode@6.24.1
    ├─ babel-preset-fbjs@2.3.0
    ├─ babel-register@6.26.0
    ├─ balanced-match@1.0.0
    ├─ base@0.11.2
    ├─ base64-js@1.3.0
    ├─ basic-auth@2.0.1
    ├─ big-integer@1.6.36
    ├─ bplist-creator@0.0.7
    ├─ bplist-parser@0.1.1
    ├─ brace-expansion@1.1.11
    ├─ braces@2.3.2
    ├─ bser@2.0.0
    ├─ builtin-modules@1.1.1
    ├─ bytes@3.0.0
    ├─ cache-base@1.0.1
    ├─ capture-exit@1.2.0
    ├─ chalk@1.1.3
    ├─ chardet@0.4.2
    ├─ chownr@1.1.1
    ├─ class-utils@0.3.6
    ├─ cli-cursor@2.1.0
    ├─ cli-width@2.2.0
    ├─ cliui@3.2.0
    ├─ code-point-at@1.1.0
    ├─ collection-visit@1.0.0
    ├─ color-convert@1.9.3
    ├─ color-name@1.1.3
    ├─ color-support@1.1.3
    ├─ commander@2.19.0
    ├─ commondir@1.0.1
    ├─ compressible@2.0.15
    ├─ compression@1.7.3
    ├─ concat-map@0.0.1
    ├─ concat-stream@1.6.2
    ├─ console-control-strings@1.1.0
    ├─ convert-source-map@1.6.0
    ├─ copy-descriptor@0.1.1
    ├─ core-js@2.5.7
    ├─ core-util-is@1.0.2
    ├─ cosmiconfig@5.0.6
    ├─ create-react-class@15.6.3
    ├─ cross-spawn@5.1.0
    ├─ debug@2.6.9
    ├─ decamelize@1.2.0
    ├─ decode-uri-component@0.2.0
    ├─ deep-extend@0.6.0
    ├─ delegates@1.0.0
    ├─ destroy@1.0.4
    ├─ detect-indent@4.0.0
    ├─ detect-libc@1.0.3
    ├─ detect-newline@2.1.0
    ├─ dom-walk@0.1.1
    ├─ ee-first@1.1.1
    ├─ encoding@0.1.12
    ├─ envinfo@5.10.0
    ├─ error-ex@1.3.2
    ├─ errorhandler@1.5.0
    ├─ esprima@4.0.1
    ├─ etag@1.8.1
    ├─ event-target-shim@1.1.1
    ├─ eventemitter3@3.1.0
    ├─ execa@0.7.0
    ├─ expand-brackets@2.1.4
    ├─ expand-range@1.8.2
    ├─ external-editor@2.2.0
    ├─ extglob@2.0.4
    ├─ fancy-log@1.3.2
    ├─ fbjs-css-vars@1.0.1
    ├─ fbjs-scripts@0.8.3
    ├─ figures@2.0.0
    ├─ filename-regex@2.0.1
    ├─ fill-range@4.0.0
    ├─ finalhandler@1.1.0
    ├─ find-cache-dir@1.0.0
    ├─ find-up@2.1.0
    ├─ for-in@1.0.2
    ├─ for-own@0.1.5
    ├─ fresh@0.5.2
    ├─ fs-minipass@1.2.5
    ├─ fs.realpath@1.0.0
    ├─ fsevents@1.2.4
    ├─ gauge@1.2.7
    ├─ get-caller-file@1.0.3
    ├─ get-stream@3.0.0
    ├─ glob-base@0.3.0
    ├─ glob-parent@2.0.0
    ├─ glob@7.1.3
    ├─ global@4.3.2
    ├─ growly@1.3.0
    ├─ has-ansi@2.0.0
    ├─ has-flag@3.0.0
    ├─ has-unicode@2.0.1
    ├─ has-value@1.0.0
    ├─ has-values@1.0.0
    ├─ home-or-tmp@3.0.0
    ├─ hosted-git-info@2.7.1
    ├─ http-errors@1.6.3
    ├─ iconv-lite@0.4.24
    ├─ ignore-walk@3.0.1
    ├─ image-size@0.6.3
    ├─ imurmurhash@0.1.4
    ├─ inflight@1.0.6
    ├─ inherits@2.0.3
    ├─ ini@1.3.5
    ├─ inquirer@3.3.0
    ├─ invariant@2.2.4
    ├─ invert-kv@1.0.0
    ├─ is-accessor-descriptor@1.0.0
    ├─ is-arrayish@0.2.1
    ├─ is-builtin-module@1.0.0
    ├─ is-data-descriptor@1.0.0
    ├─ is-descriptor@1.0.2
    ├─ is-directory@0.3.1
    ├─ is-dotfile@1.0.3
    ├─ is-equal-shallow@0.1.3
    ├─ is-finite@1.0.2
    ├─ is-fullwidth-code-point@1.0.0
    ├─ is-plain-object@2.0.4
    ├─ is-posix-bracket@0.1.1
    ├─ is-primitive@2.0.0
    ├─ is-promise@2.1.0
    ├─ is-stream@1.1.0
    ├─ is-windows@1.0.2
    ├─ isarray@1.0.0
    ├─ isexe@2.0.0
    ├─ jest-docblock@23.2.0
    ├─ jest-serializer@23.0.1
    ├─ jest-worker@23.2.0
    ├─ js-tokens@4.0.0
    ├─ js-yaml@3.12.0
    ├─ jsesc@2.5.1
    ├─ json-parse-better-errors@1.0.2
    ├─ json-stable-stringify@1.0.1
    ├─ json5@0.5.1
    ├─ jsonfile@2.4.0
    ├─ kind-of@3.2.2
    ├─ klaw@1.3.1
    ├─ lcid@1.0.0
    ├─ load-json-file@2.0.0
    ├─ locate-path@2.0.0
    ├─ lodash.pad@4.5.1
    ├─ lodash.padend@4.6.1
    ├─ lodash.padstart@4.6.1
    ├─ lru-cache@4.1.3
    ├─ make-dir@1.3.0
    ├─ makeerror@1.0.11
    ├─ map-visit@1.0.0
    ├─ math-random@1.0.1
    ├─ mem@1.1.0
    ├─ merge@1.2.0
    ├─ metro-babel-register@0.48.1
    ├─ metro-babel7-plugin-react-transform@0.48.1
    ├─ metro-config@0.48.1
    ├─ metro-memory-fs@0.48.1
    ├─ metro-minify-uglify@0.48.1
    ├─ metro-react-native-babel-preset@0.48.1
    ├─ metro-source-map@0.48.1
    ├─ metro@0.48.1
    ├─ mime-db@1.36.0
    ├─ mime-types@2.1.11
    ├─ mime@1.6.0
    ├─ min-document@2.19.0
    ├─ minimatch@3.0.4
    ├─ minimist@1.2.0
    ├─ minizlib@1.1.1
    ├─ mixin-deep@1.3.1
    ├─ mkdirp@0.5.1
    ├─ morgan@1.9.1
    ├─ mute-stream@0.0.7
    ├─ nan@2.11.1
    ├─ nanomatch@1.2.13
    ├─ needle@2.2.4
    ├─ negotiator@0.6.1
    ├─ node-int64@0.4.0
    ├─ node-modules-regexp@1.0.0
    ├─ node-notifier@5.2.1
    ├─ node-pre-gyp@0.10.3
    ├─ nopt@4.0.1
    ├─ normalize-package-data@2.4.0
    ├─ normalize-path@2.1.1
    ├─ npm-bundled@1.0.5
    ├─ npm-packlist@1.1.12
    ├─ npm-run-path@2.0.2
    ├─ npmlog@2.0.4
    ├─ nullthrows@1.1.0
    ├─ object-assign@4.1.1
    ├─ object-copy@0.1.0
    ├─ object.omit@2.0.1
    ├─ onetime@2.0.1
    ├─ opn@3.0.3
    ├─ optimist@0.6.1
    ├─ options@0.0.6
    ├─ os-homedir@1.0.2
    ├─ os-locale@2.1.0
    ├─ os-tmpdir@1.0.2
    ├─ osenv@0.1.5
    ├─ p-finally@1.0.0
    ├─ p-limit@1.3.0
    ├─ p-locate@2.0.0
    ├─ p-try@1.0.0
    ├─ parse-glob@3.0.4
    ├─ parse-json@4.0.0
    ├─ pascalcase@0.1.1
    ├─ path-exists@3.0.0
    ├─ path-is-absolute@1.0.1
    ├─ path-key@2.0.1
    ├─ path-parse@1.0.6
    ├─ path-type@2.0.0
    ├─ pegjs@0.10.0
    ├─ pirates@4.0.0
    ├─ pkg-dir@2.0.0
    ├─ plist@3.0.1
    ├─ plugin-error@0.1.2
    ├─ posix-character-classes@0.1.1
    ├─ preserve@0.2.0
    ├─ pretty-format@4.3.1
    ├─ private@0.1.8
    ├─ process-nextick-args@2.0.0
    ├─ process@0.5.2
    ├─ prop-types@15.6.2
    ├─ pseudomap@1.0.2
    ├─ randomatic@3.1.0
    ├─ range-parser@1.2.0
    ├─ rc@1.2.8
    ├─ react-clone-referenced-element@1.1.0
    ├─ react-deep-force-update@1.1.2
    ├─ react-devtools-core@3.4.0
    ├─ react-native@0.57.3
    ├─ react-proxy@1.1.8
    ├─ react-timer-mixin@0.13.4
    ├─ read-pkg-up@2.0.0
    ├─ read-pkg@2.0.0
    ├─ readable-stream@2.3.6
    ├─ regenerate-unicode-properties@7.0.0
    ├─ regenerator-transform@0.13.3
    ├─ regex-cache@0.4.4
    ├─ regex-not@1.0.2
    ├─ regexpu-core@4.2.0
    ├─ regjsgen@0.4.0
    ├─ regjsparser@0.3.0
    ├─ remove-trailing-separator@1.1.0
    ├─ repeating@2.0.1
    ├─ require-directory@2.1.1
    ├─ require-main-filename@1.0.1
    ├─ resolve-url@0.2.1
    ├─ resolve@1.8.1
    ├─ restore-cursor@2.0.0
    ├─ ret@0.1.15
    ├─ rimraf@2.6.2
    ├─ rsvp@3.6.2
    ├─ run-async@2.3.0
    ├─ rx-lite-aggregates@4.0.8
    ├─ rx-lite@4.0.8
    ├─ safer-buffer@2.1.2
    ├─ sane@2.5.2
    ├─ sax@1.1.6
    ├─ semver@5.6.0
    ├─ send@0.16.2
    ├─ serialize-error@2.1.0
    ├─ serve-static@1.13.2
    ├─ set-blocking@2.0.0
    ├─ set-value@2.0.0
    ├─ setprototypeof@1.1.0
    ├─ shebang-command@1.2.0
    ├─ shebang-regex@1.0.0
    ├─ shell-quote@1.6.1
    ├─ shellwords@0.1.1
    ├─ signal-exit@3.0.2
    ├─ simple-plist@0.2.1
    ├─ slash@1.0.0
    ├─ slide@1.1.6
    ├─ snapdragon-node@2.1.1
    ├─ snapdragon-util@3.0.1
    ├─ source-map-resolve@0.5.2
    ├─ source-map-support@0.5.9
    ├─ source-map-url@0.4.0
    ├─ spdx-correct@3.0.2
    ├─ spdx-exceptions@2.2.0
    ├─ split-string@3.1.0
    ├─ sprintf-js@1.0.3
    ├─ stacktrace-parser@0.1.4
    ├─ static-extend@0.1.2
    ├─ statuses@1.3.1
    ├─ stream-buffers@2.2.0
    ├─ string_decoder@1.1.1
    ├─ string-width@1.0.2
    ├─ strip-ansi@3.0.1
    ├─ strip-bom@3.0.0
    ├─ strip-eof@1.0.0
    ├─ strip-json-comments@2.0.1
    ├─ supports-color@2.0.0
    ├─ tar@4.4.6
    ├─ temp@0.8.3
    ├─ throat@4.1.0
    ├─ through@2.3.8
    ├─ through2@2.0.3
    ├─ time-stamp@1.1.0
    ├─ tmp@0.0.33
    ├─ tmpl@1.0.4
    ├─ to-fast-properties@2.0.0
    ├─ to-regex-range@2.1.1
    ├─ typedarray@0.0.6
    ├─ uglify-es@3.3.9
    ├─ ultron@1.0.2
    ├─ unicode-canonical-property-names-ecmascript@1.0.4
    ├─ unicode-match-property-ecmascript@1.0.4
    ├─ unicode-match-property-value-ecmascript@1.0.2
    ├─ unicode-property-aliases-ecmascript@1.0.4
    ├─ union-value@1.0.0
    ├─ unpipe@1.0.0
    ├─ unset-value@1.0.0
    ├─ urix@0.1.0
    ├─ use@3.1.1
    ├─ util-deprecate@1.0.2
    ├─ utils-merge@1.0.1
    ├─ uuid@3.0.1
    ├─ validate-npm-package-license@3.0.4
    ├─ vary@1.1.2
    ├─ walker@1.0.7
    ├─ watch@0.18.0
    ├─ whatwg-fetch@3.0.0
    ├─ which-module@2.0.0
    ├─ which@1.3.1
    ├─ wide-align@1.1.3
    ├─ wrap-ansi@2.1.0
    ├─ write-file-atomic@1.3.4
    ├─ xcode@0.9.3
    ├─ xmlbuilder@9.0.7
    ├─ xmldoc@0.4.0
    ├─ xpipe@1.0.5
    ├─ xtend@4.0.1
    ├─ y18n@3.2.1
    ├─ yallist@3.0.2
    └─ yargs-parser@7.0.0
    ✨  Done in 104.56s.
    Setting up new React Native app in /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject
    Adding React...
    yarn add v1.10.1
    [1/4] ????  Resolving packages...
    [2/4] ????  Fetching packages...
    [3/4] ????  Linking dependencies...
    warning "react-native > metro > babel-preset-fbjs > @babel/plugin-check-constants@7.0.0-beta.38" has incorrect peer dependency "@babel/core@7.0.0-beta.38".
    [4/4] ????  Building fresh packages...
    success Saved lockfile.
    success Saved 2 new dependencies.
    info Direct dependencies
    └─ react@16.6.0-alpha.8af6728
    info All dependencies
    ├─ react@16.6.0-alpha.8af6728
    └─ scheduler@0.10.0-alpha.f47a958
    ✨  Done in 19.14s.
    Adding Jest...
    yarn add v1.10.1
    [1/4] ????  Resolving packages...
    [2/4] ????  Fetching packages...
    [3/4] ????  Linking dependencies...
    warning "metro-react-native-babel-preset > @babel/plugin-proposal-class-properties@7.1.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-proposal-nullish-coalescing-operator@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-proposal-object-rest-spread@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-proposal-optional-catch-binding@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-proposal-optional-chaining@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-flow-strip-types@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-modules-commonjs@7.1.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "react-native > metro > babel-preset-fbjs > @babel/plugin-check-constants@7.0.0-beta.38" has incorrect peer dependency "@babel/core@7.0.0-beta.38".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-arrow-functions@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-block-scoping@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-classes@7.1.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-computed-properties@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-destructuring@7.1.3" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-for-of@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-function-name@7.1.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-literals@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-parameters@7.1.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-react-display-name@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-react-jsx@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-shorthand-properties@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-spread@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-template-literals@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-proposal-export-default-from@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-syntax-dynamic-import@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-syntax-export-default-from@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-exponentiation-operator@7.1.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-object-assign@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-react-jsx-source@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-regenerator@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-runtime@7.1.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-sticky-regex@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-typescript@7.1.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning "metro-react-native-babel-preset > @babel/plugin-transform-unicode-regex@7.0.0" has unmet peer dependency "@babel/core@^7.0.0-0".
    warning " > babel-jest@23.6.0" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-0".
    warning " > babel-jest@23.6.0" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-0".
    [4/4] ????  Building fresh packages...
    success Saved lockfile.
    success Saved 120 new dependencies.
    info Direct dependencies
    ├─ babel-jest@23.6.0
    ├─ jest@23.6.0
    ├─ metro-react-native-babel-preset@0.48.1
    └─ react-test-renderer@16.6.0-alpha.8af6728
    info All dependencies
    ├─ acorn-globals@4.3.0
    ├─ acorn-walk@6.1.0
    ├─ acorn@5.7.3
    ├─ ajv@5.5.2
    ├─ append-transform@0.4.0
    ├─ array-equal@1.0.0
    ├─ arrify@1.0.1
    ├─ asn1@0.2.4
    ├─ astral-regex@1.0.0
    ├─ asynckit@0.4.0
    ├─ aws-sign2@0.7.0
    ├─ aws4@1.8.0
    ├─ babel-jest@23.6.0
    ├─ babel-plugin-jest-hoist@23.2.0
    ├─ bcrypt-pbkdf@1.0.2
    ├─ browser-process-hrtime@0.1.3
    ├─ browser-resolve@1.11.3
    ├─ callsites@2.0.0
    ├─ caseless@0.12.0
    ├─ ci-info@1.6.0
    ├─ cliui@4.1.0
    ├─ combined-stream@1.0.7
    ├─ cssom@0.3.4
    ├─ cssstyle@1.1.1
    ├─ dashdash@1.14.1
    ├─ data-urls@1.0.1
    ├─ deep-is@0.1.3
    ├─ default-require-extensions@1.0.0
    ├─ diff@3.5.0
    ├─ domexception@1.0.1
    ├─ ecc-jsbn@0.1.2
    ├─ es-abstract@1.12.0
    ├─ es-to-primitive@1.2.0
    ├─ escodegen@1.11.0
    ├─ estraverse@4.2.0
    ├─ expect@23.6.0
    ├─ extend@3.0.2
    ├─ extsprintf@1.3.0
    ├─ fast-deep-equal@1.1.0
    ├─ fast-levenshtein@2.0.6
    ├─ fileset@2.0.3
    ├─ forever-agent@0.6.1
    ├─ form-data@2.3.2
    ├─ getpass@0.1.7
    ├─ handlebars@4.0.12
    ├─ har-schema@2.0.0
    ├─ har-validator@5.1.0
    ├─ has-symbols@1.0.0
    ├─ html-encoding-sniffer@1.0.2
    ├─ http-signature@1.2.0
    ├─ is-callable@1.1.4
    ├─ is-date-object@1.0.1
    ├─ is-generator-fn@1.0.0
    ├─ is-regex@1.0.4
    ├─ is-symbol@1.0.2
    ├─ is-typedarray@1.0.0
    ├─ is-utf8@0.2.1
    ├─ isstream@0.1.2
    ├─ istanbul-api@1.3.7
    ├─ istanbul-lib-hook@1.2.2
    ├─ istanbul-lib-report@1.1.5
    ├─ istanbul-lib-source-maps@1.2.6
    ├─ istanbul-reports@1.5.1
    ├─ jest-changed-files@23.4.2
    ├─ jest-cli@23.6.0
    ├─ jest-each@23.6.0
    ├─ jest-environment-node@23.4.0
    ├─ jest-leak-detector@23.6.0
    ├─ jest-resolve-dependencies@23.6.0
    ├─ jest-runner@23.6.0
    ├─ jest-watcher@23.4.0
    ├─ jest@23.6.0
    ├─ jsdom@11.12.0
    ├─ json-schema-traverse@0.3.1
    ├─ json-schema@0.2.3
    ├─ json-stringify-safe@5.0.1
    ├─ jsprim@1.4.1
    ├─ kleur@2.0.2
    ├─ left-pad@1.3.0
    ├─ leven@2.1.0
    ├─ levn@0.3.0
    ├─ metro-react-native-babel-preset@0.48.1
    ├─ natural-compare@1.4.0
    ├─ nwsapi@2.0.9
    ├─ oauth-sign@0.9.0
    ├─ object-keys@1.0.12
    ├─ object.getownpropertydescriptors@2.0.3
    ├─ optionator@0.8.2
    ├─ parse5@4.0.0
    ├─ performance-now@2.1.0
    ├─ pinkie@2.0.4
    ├─ pn@1.1.0
    ├─ prompts@0.1.14
    ├─ psl@1.1.29
    ├─ punycode@1.4.1
    ├─ qs@6.5.2
    ├─ react-is@16.6.0-alpha.8af6728
    ├─ react-test-renderer@16.6.0-alpha.8af6728
    ├─ request-promise-core@1.1.1
    ├─ request-promise-native@1.0.5
    ├─ request@2.88.0
    ├─ resolve-cwd@2.0.0
    ├─ resolve-from@3.0.0
    ├─ sisteransi@0.1.1
    ├─ sshpk@1.15.1
    ├─ stack-utils@1.0.1
    ├─ stealthy-require@1.1.1
    ├─ symbol-tree@3.2.2
    ├─ test-exclude@4.2.3
    ├─ tough-cookie@2.4.3
    ├─ tunnel-agent@0.6.0
    ├─ tweetnacl@0.14.5
    ├─ uglify-js@3.4.9
    ├─ util.promisify@1.0.0
    ├─ verror@1.10.0
    ├─ w3c-hr-time@1.0.1
    ├─ whatwg-encoding@1.0.5
    ├─ whatwg-url@6.5.0
    ├─ xml-name-validator@3.0.0
    └─ yargs-parser@9.0.2
    ✨  Done in 26.94s.
To run your app on iOS:
   cd /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject
   react-native run-ios
   - or -
   Open ios/AwesomeProject.xcodeproj in Xcode
   Hit the Run button
To run your app on Android:
   cd /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject
   Have an Android emulator running (quickest way to get started), or a device connected
   react-native run-android

然后,即使有所有这些警告,我也尝试运行 react-native run-ios,但出现以下错误:

❌  error: Build input file cannot be found: '/Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/node_modules/react-native/third-party/double-conversion-1.1.6/src/fixed-dtoa.cc'


▸ Compiling fast-dtoa.cc

❌  error: Build input file cannot be found: '/Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/node_modules/react-native/third-party/double-conversion-1.1.6/src/fast-dtoa.cc'


▸ Compiling strtod.cc

❌  error: Build input file cannot be found: '/Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc'


** BUILD FAILED **


The following build commands failed:

    CompileC /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/fixed-dtoa.o /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/node_modules/react-native/third-party/double-conversion-1.1.6/src/fixed-dtoa.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    CompileC /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/fast-dtoa.o /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/node_modules/react-native/third-party/double-conversion-1.1.6/src/fast-dtoa.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    CompileC /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/strtod.o /Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(3 failures)

Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist


Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

    at checkExecSyncError (child_process.js:611:11)
    at Object.execFileSync (child_process.js:629:13)
    at Promise.then (/Volumes/HD2/fabiobergmann/WebstormProjects/AwesomeProject/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
    at process._tickCallback (internal/process/next_tick.js:68:7)

知道发生了什么或解决方法吗?

【问题讨论】:

github.com/facebook/react-native/issues/21168 可能有你需要的东西 谢谢@AlexHarris。我找到了另一个对我也有帮助的帖子。我刚刚用适合我的解决方案回答了我的问题。 【参考方案1】:

我能够按照here 的说明构建和运行我的项目。

更具体地说:

# Clean cache
rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all

# Open a new tab and Start Metro Bundler directly from the project folder
react-native start  --reset-cache

# Now run `react-native run-android` or `react-native run-ios`

它可以工作,但是这样开始,这让我害怕使用 react native 构建项目。

【讨论】:

以上是关于react-native init 项目警告和错误的主要内容,如果未能解决你的问题,请参考以下文章

“react-native init project”命令不起作用

React-Native 安装时遇到的问题

npx react-native init 错误在 appdata 文件夹中不包含 package.json 文件

react-native ios项目+内存泄漏

react-native init 指定 react 版本和 react-native 版本

Expo Init 项目中的“错误:spawn cmd ENOENT”