'Error while traying to resolve module, npm always installs the module's lib folder empty
The main error:
Error: While trying to resolve module `@pinwheel/react-native-pinwheel` from file `/Users/juanmanuellopez-gabeiras/Projects/unlocked-mobile/src/session/components/PinWheelScreen.js`, the package `/Users/juanmanuellopez-gabeiras/Projects/unlocked-mobile/node_modules/@pinwheel/react-native-pinwheel/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/juanmanuellopez-gabeiras/Projects/unlocked-mobile/node_modules/@pinwheel/react-native-pinwheel/lib/index.js`.
Here you can see how the installed node module looks, for some reason instead of installing the index.js files the main module specifies, it just repeats the packaje.json.
I have tried reinstalling and deleting the node-modules, the package-lock.json, cleared the npm cache and installing the same package in a different project. The only way I found for resolving this issue temporarily is having a college send me the missing lib files.
Some things to mention are that I am using nvm 0.39.1, node 16.13.2 and npm 8.1.2. All running on M1 macbook with macOS 12.2.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
