React-native: init new project error with React-Native 0.43-rc4

Created on 22 Mar 2017  路  10Comments  路  Source: facebook/react-native

NPM version: 4.4.1
Xcode version: 8.2 (8C38)
React Native version: 0.43-rc1~4
Platform: iOS
Operating System: MacOS os x EI Capitan

react-native 0.42.3 no problem.

react-native init --version="0.43.0-rc.4" FlatListTest4

error message:
2017-03-22 18:24:09.965 [warn][tid:NSOperationQueue 0x618000030700 :: NSOperation 0x61800004f390 (QOS: DEFAULT)][RCTBatchedBridge.m:113] Failed to load source: Error Domain=JSServer Code=500 "Unable to resolve module react/lib/ReactComponentWithPureRenderMixin from /Users/zlk/Downloads/ReactNative/FlatListTest4/node_modules/react-native/Libraries/react-native/react-native-implementation.js: Module does not exist in the module map or in these directories:
/Users/zlk/Downloads/ReactNative/FlatListTest4/node_modules/react/lib

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start --reset-cache." UserInfo={stack=(
    {
    file = "";
    lineNumber = 0;
    methodName = "";
    }
    ), NSLocalizedDescription=Unable to resolve module react/lib/ReactComponentWithPureRenderMixin from /Users/zlk/Downloads/ReactNative/FlatListTest4/node_modules/react-native/Libraries/react-native/react-native-implementation.js: Module does not exist in the module map or in these directories:
    /Users/zlk/Downloads/ReactNative/FlatListTest4/node_modules/react/lib

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start --reset-cache.}
    2017-03-22 18:24:09.978 [fatal][tid:main] Unable to resolve module react/lib/ReactComponentWithPureRenderMixin from /Users/zlk/Downloads/ReactNative/FlatListTest4/node_modules/react-native/Libraries/react-native/react-native-implementation.js: Module does not exist in the module map or in these directories:
    /Users/zlk/Downloads/ReactNative/FlatListTest4/node_modules/react/lib

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start --reset-cache.
Locked

Most helpful comment

I confirm the problem.

It's is due to the React version 16.0.0-alpha.5 published on NPM yesterday.

Fix your React version to ~16.0.0-alpha.4~ (EDIT: 16.0.0-alpha.3, my bad) in your package.jsonand re-install the dependencies.

It's a serious issue though, because all existing projects using 0.43-rc* are concerned.

All 10 comments

I confirm the problem.

It's is due to the React version 16.0.0-alpha.5 published on NPM yesterday.

Fix your React version to ~16.0.0-alpha.4~ (EDIT: 16.0.0-alpha.3, my bad) in your package.jsonand re-install the dependencies.

It's a serious issue though, because all existing projects using 0.43-rc* are concerned.

npm ERR! notarget No compatible version found: [email protected]
npm ERR! notarget Valid install targets:
npm ERR! notarget 1.0.0, 1.1.0, 15.3.0, 15.3.1-rc.1, 15.3.1-rc.2, 15.3.1, 15.3.2-rc.1, 15.3.2, 15.4.0-rc.1, 15.4.0-rc.2, 15.4.0-rc.3, 15.4.0-rc.4, 15.4.0, 15.4.1, 15.4.2, 16.0.0-alpha, 16.0.0-alpha.0, 16.0.0-alpha.2, 16.0.0-alpha.3, 16.0.0-alpha.5

16.0.0-alpha.3 is ok.

I think the problem is that we didn't pin the React version during one of the previous syncs: https://github.com/facebook/react-native/commit/24a7665df5c35e0db32572c6ff83f51392c43f13#commitcomment-21457443. So now every time we release a new alpha of react (potentially with breaking changes because it's an alpha), React Native RC that contains ~ in the peer dependency will let the users happily upgrade to a broken version.

For people in this thread, the solution is to pin your react version in package.json to 16.0.0-alpha.4. Your code might not work with 16.0.0-alpha.5 until we do another sync.

(And we need to pin React versions in the future, just like we did before. I'm not sure why we broke the pattern, and whether it was intentional or not.)

The package build issue should be resolved as far as I'm aware with https://github.com/facebook/react-native/commit/a2cfea1934ab3682b2597a53de0b2b00a319832f

The followup we agreed on is @bvaughn will submit a PR removing ~ from package.json and coordinate with @mkonicek to get a similar change into RC branch.

The solution suggested by ncuillery did not work for me. I still get same "No bundle url present" error.

Same in here. Even a new project with react-native 0.43.3 gives me the same issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lazywei picture lazywei  路  3Comments

anchetaWern picture anchetaWern  路  3Comments

grabbou picture grabbou  路  3Comments

aniss picture aniss  路  3Comments

despairblue picture despairblue  路  3Comments