search

Home  >  Q&A  >  body text

javascript - Regarding the node_modules reference path problem of react natived

Currently there are multiple projects, all of which are in /work/project
Each project uses a module: A

According to npm's search order, if the module is not found in the node_modules of the current project, it will search in the node_modules of the parent directory. However, the node_modules of the parent directory clearly contains the module react native, but an error is reported saying that it is not there.
What causes this?

Although I can install this module into node_modules in each project, because this module A will be modified every day, sharing one is the best way. How to achieve this requirement?

漂亮男人漂亮男人2781 days ago681

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-06-05 11:13:45

    import ReactNativeDeviceInfo from '../../react-native-device-info';

    reply
    0
  • Cancelreply