Skip to content

[0.23.0-rc1] Cannot resolve react-native #6640

Closed

Description

@IanVS

On mac, npm v.3.8.2, node 5.3.0:

On a fresh install:

npm i --save react react-native@next

The install seems to complete successfully.

npm ls --depth=0
rn@1.0.0 /Users/ianvs/code/experiments/rn
├── react@0.14.7
└── react-native@0.23.0-rc1

But:

npm ls react
rn@1.0.0 /Users/ianvs/code/experiments/rn
└── react@0.14.7

npm ls react-native
rn@1.0.0 /Users/ianvs/code/experiments/rn
└── (empty)

npm ERR! code 1

This is causing problems in some third party libraries I use which import RN with var React = require('react-native);`.

image

I had no trouble with 0.22.2.

Activity

  1. changed the title [-][0.23.0-rc1] NPM cannot resolve react-native[/-] [+][0.23.0-rc1] Cannot resolve react-native[/+] on Mar 24, 2016
  2. tyao1 commented on Mar 25, 2016

    @tyao1
    Contributor

    Same here. After upgrading to 0.23-rc1, on android, a third party module throws unable to resolve module Subscribable. Everything works on iOS, and works on 0.22.2 and before.

  3. rogchap commented on Mar 25, 2016

    @rogchap
    Contributor

    Do you have Hot Reloading Enabled? I had this issue and switching off Hot Reloading "solved" it.

  4. brentvatne commented on Mar 26, 2016

    @brentvatne
    Collaborator

    I had the same issue with HMR enabled @rogchap

    @cpojer -- @skevy thought this might be a node-haste bug

  5. IanVS commented on Mar 28, 2016

    @IanVS
    Author

    Surprisingly yes, disabling hot reloading did prevent the redboxes (both Android and iOS). Is the npm ls behavior a red herring?

  6. cpojer commented on Mar 28, 2016

    @cpojer
    Contributor
  7. martinbigio commented on Mar 28, 2016

    @martinbigio
    Contributor

    Hmm I cannot repro neither on master nor @next. Doesn't make sense that this repro only with HMR enabled. @brentvatne, @IanVS could you guys try reseting the packagers cache?

    @satya164, have you seen this issue?

  8. IanVS commented on Mar 28, 2016

    @IanVS
    Author

    I used npm start -- --clear-cache with no change in behavior.

  9. martinbigio commented on Mar 28, 2016

    @martinbigio
    Contributor

    @IanVS you should run npm start -- --reset-cache (reset-cache instead of clear-cache).

  10. IanVS commented on Mar 28, 2016

    @IanVS
    Author

    No luck. I'll try to create a minimal reproduction.

  11. IanVS commented on Mar 28, 2016

    @IanVS
    Author

    I can reproduce on a clean install with:

    react-native init repro
    cd repro
    npm i --save react-native-vector-icons react-native@next
    

    Add the following to the top of index.ios.js:

    import Icon from 'react-native-vector-icons';

    Starting it up should work fine, getting the default "Welcome to React Native!" screen.

    react-native run-ios
    

    But, if you enable hot reloading, you should see a redbox similar to the one I posted above.

  12. martinbigio commented on Mar 28, 2016

    @martinbigio
    Contributor

    Thanks @IanVS, I can repro following your steps.

    The require on the HMR path happens here: https://github.com/facebook/react-native/blob/3a1634ec7b0dfa2b5d8890118565006d845e2039/babel-preset/configs/hmr.js#L28.

    Not sure why this broke but changing React for react-native should be equivalent and it works. Will submit PR and publish a new version of the preset soon.

  13. satya164 commented on Mar 29, 2016

    @satya164
    Contributor

    Only happens when you install some other pacakge? Weird.

  14. ghost added a commit that references this issue on Mar 29, 2016
  15. martinbigio commented on Mar 30, 2016

    @martinbigio
    Contributor

    Should work now that we have released babel-preset-react-native@1.5.5. You'll have to upgrade from 1.5.4 to 1.5.5

  16. locked as resolved and limited conversation to collaborators on May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions