Currently, I have a project for an app and two separate node module projects. The dependency structure looks something like this:
App {
NodeModule1 {
NodeModule2,
...
},
...
}
The issue I am facing is that instead of NodeModule2 being installed in the root directory of the app's node_modules App/node_modules/NodeModule2
, it is actually installed in
App/node_modules/NodeModule1/node_modules/NodeModule2
This unexpected location is causing runtime errors where NodeModule2 is not found. My temporary solution has been to directly add NodeModule2 into the App folder, but this is not an ideal long-term fix.
All other dependencies of NodeModule1 are correctly installed at App/node_modules as expected.
Here is the package.json file for NodeModule2:
{
"name": "NodeModule2",
"version": "0.0.2-20210202.1.0",
"private": false,
"description": "",
"author": "",
"license": "ISC",
"peerDependencies": {
"react": "16.13.1",
"react-native": "0.59.10",
...
}
}