Starting with a fresh project (npx react-native init MyTestApp), when I run npm list @react-native-community/cli I get:
[email protected] /Users/user/Desktop/Projects/MyTestApp
└── (empty)
The bigger issue is that I can't run pod install, I get:
throw err;
^
Error: Cannot find module '/MyTestApp/node_modules/@react-native-community/cli/build/bin.js
However, I see @react-native-community/cli/build/bin.js in node_modules
For reference, package.json:
{
"name": "MyTestApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/cli": "^4.6.0",
"react": "16.11.0",
"react-native": "0.62.1"
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/runtime": "^7.6.2",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
I have an existing project that I want to upgrade, but I get the same error. That's why I decided to try a fresh project. However, I'm getting the same error in the fresh project too.
pod version = 1.9.1
node version = v8.3.0
npm version = 5.2.0
I was having the same problem where I see the file in node module but still giving me same error.
This might sound crazy as it does to me but for some reason I get this error only when I run pod install from the VS Code Terminal but when I run this same from MacOS terminal it worked fine and pod were installed.
It may not work for you but worth giving a shot while it worked for me. :)
As mentioned by Kieran in another comment, if you use VSCode, make sure you turn disable auto-attach for the vscode debugger.
cmd + shift + p -> Debug: toggle auto attach -> disable
My problem was solved by this.
Also, trying pod install outside of vscode in a normal terminal should be working as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With