Unable to resolve module ./app.json in RN version 0.70 - metro-bundler

I was Working in RN 0.69.2 version. Yesterday I have upgrade it to RN 0.70 version.
I followed the guideline in React native helper. But I got error in Metor, it's says unable to resolve module './app.json'. when I tried to npm start --reset-cache I got other error which says
References Error sha-1 .
I tried all solutions in stackoverflow but the Error wasn't solved.

I'm having the same issue, able to resolve it by adding json at the end of metro.config.js file under resolvers like this
resolver: {
sourceExts: ['jsx', 'js', 'ts', 'tsx', 'json'], //add here
}

Related

Frame Processor threw an error: Value is undefined, expected an Object

In react native Project i installed react-native-vision-camera and react-native reanimated and then react-native-hole after running the project it gives me the error Frame Processor threw an error: Value is undefined, expected an Object
though camera is opened but it comes repeatedly the error, Please help to overcome the solution...i want to make the QR Code Scanner ...the react native QRScanner is getting deprecated please help for making QR Scanner in React Native ..Please help
I solved this issue by following these steps-
Change in your babel config-
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
// <-- this
'react-native-reanimated/plugin',
{
globals: ['__scanCodes'],
},
],
],
};
npm start -- --reset-cache
add import 'react-native-reanimated'; at the top on index.js file

Unable to resolve module `stream`

This error starting showing up all of a sudden.
Node : v10.16.3
React native : 0.60.5
react-native-cli: 2.0.1
bundling failed: Error: Unable to resolve module stream from /Users/username/React Native/SampleApp/node_modules/browser-stdout/index.js: Module stream does not exist in the Haste module map
It's giving error for this line :
var WritableStream = require('stream').Writable
I tried installing 'stream' via npm
npm install stream
Then other similar errors started showing up.
One option is to use the client package readable-stream. If dependencies are requiring stream, then i would suggest adding the following to your babel config as well.
yarn add readable-stream
yarn add -D babel-plugin-rewrite-require
babel.config.js
module.exports = {
// rest of config
plugins: [
// other plugins
[
'babel-plugin-rewrite-require',
{
aliases: {
stream: 'readable-stream',
},
},
],
],
};
just install stream using npm install stream and run the project again.

error Failed to get dependency config. while installing fonts

I am trying to install fonts with
react-native link ./assets/fonts/ and with react-native link
both are giving the same error:
"error Failed to get dependency config."
I updated my package.json
"rnpm": {
"assets": [
"./assets/fonts/"
]
}
Please help
I have made sure the path to the font folder is correct and still same problem
re-install and re-link solves the problem in my case
What version of your react-native?
If it is> 0.60, it is recommended to create the react-native.config.js file with the configurations below:
module.exports = {
project: {
ios: {},
android: {}, // grouped into "project"
},
assets: [
'./assets/fonts/',
],
};
Link without specifying the package name and it should work
react-native link

Expo start don't works after Upgrading Expo 26 to 32

After upgrading expo from: SDK 26 to SDK 32, I have the following issue when I use expo run emulator or expo app:
/Users/name user/project name/node_modules/expo/AppEntry.js: Cannot read property ‘1’ of undefined
AppEntry.js:
import { KeepAwake, registerRootComponent } from 'expo';
import App from '../../App';
if (__DEV__) {
KeepAwake.activate();
}
registerRootComponent(App);
package.json:
{
“main”: “node_modules/expo/AppEntry.js”,
“private”: true,
“scripts”: {
“test”: “node ./node_modules/jest/bin/jest.js --watchAll”
},
“jest”: {
“preset”: “jest-expo”
},
“dependencies”: {
“#expo/samples”: “2.1.1”,
“babel-preset-expo”: “^5.1.1”,
“expo”: “^32.0.0”,
“npm”: “^4.6.1”,
“react”: “16.5.0”,
“react-native”: “https://github.com/expo/react-
native/archive/sdk- 32.0.0.tar.gz”,
“react-native-animatable”: “^1.2.4”,
“react-native-device-info”: “^0.21.5”,
“react-native-drawer”: “^2.5.0”,
“react-native-drawer-menu”: “^0.2.5”,
“react-native-elements”: “^0.19.1”,
“react-native-fetch-polyfill”: “^1.1.2”,
“react-native-geocoder”: “^0.5.0”,
“react-native-geocoding”: “^0.3.0”,
“react-native-google-maps-directions”: “^2.0.0”,
“react-native-keyboard-spacer”: “^0.4.1”,
“react-native-maps”: “^0.21.0”,
“react-native-masked-text”: “^1.6.5”,
“react-native-qrcode-svg”: “^5.1.1”,
“react-native-select-input-ios”: “^1.2.0”,
“react-native-swipeable”: “^0.6.0”,
“react-native-swiper”: “^1.5.13”,
“react-native-touch-id”: “^4.0.4”,
“react-native-vector-icons”: “^4.6.0”,
“react-navigation”: “^3.0.9”
},
“devDependencies”: {
“#babel/core”: “^7.4.3”,
“#babel/preset-env”: “^7.0.0-beta.47”,
“gulp-babel”: “^7.0.1”,
“jest-expo”: “^32.0.0”
}
}
EDIT:
After adjusting at the suggestion, I'm getting this error:
Users/user name/project name/App.js: Cannot read property 'filename' of undefined
Any ideas on potential solutions to try? Any help would be greatly appreciated!
Looking at the issue log for expo, I see someone else had a similar issue when updating from:
SDK version 30 to SDK version 31
and the issue was related to their babel configuration. Perhaps you're dealing with the same issue, maybe you could try the solution they suggested and see if that resolves your issue as well since you're updating from SDK version 26.
Here is what they suggested:
Install the latest version of babel-plugin-module-resolver:
npm i --save-dev babel-plugin-module-resolver#latest
alternatively:
yarn add babel-plugin-module-resolver#latest
Additionally, others had to change their .babelrc contents to use the "babel-preset-expo" preset:
.babelrc
{
"presets": ["babel-preset-expo"]
}
Hopefully that helps!

react-native-svg not resolved | victory-native

I am trying to work with victory-native package for graph for react-native platform. I have installed both victory-native and react-native-svg with --save command. And then I also linked them with
react-native link but now when I do react-native start it throws the following error:
error: bundling failed: Error: While trying to resolve module `react-native-
svg` from file `/Users/keshav/projects/PropertyFinder/node_modules/victory-
native/lib/components/victory-primitives/line.js`, the package
`/Users/keshav/projects/PropertyFinder/node_modules/react-native-svg/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved
(`/Users/keshav/projects/PropertyFinder/node_modules/react-native-svg/index.js`. Indeed, none of these files exist:
* `/Users/keshav/projects/PropertyFinder/node_modules/react-native-svg/index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
* `/Users/keshav/projects/PropertyFinder/node_modules/react-native-svg/index.js/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
at ResolutionRequest.resolveDependency
(/Users/keshav/projects/PropertyFinder/node_modules/metro/src/node-
haste/DependencyGraph/ResolutionRequest.js:104:15)
```
My package.json:
"react": "16.3.0-alpha.2",
"react-native": "0.54.2",
"react-native-svg": "^6.3.0",
"react-navigation": "^1.5.7",
"simple-swizzle": "^0.2.2",
"superagent": "^3.8.2",
"victory-native": "^0.17.2"
What is wrong here?
I met the same problem.But the different is i used the 'react-native-tab-navigator'.I've tried many times with different ways until i restarted Xcode and rebuilt the project.I hope this can help you.
Late to the party, but I had to modify my metro.config.js file as follows:
module.exports = {
...
resolver: {
sourceExts: ['js', 'jsx', 'ts', 'tsx']
}
}
I think this is to help metro resolve paths beyond js, jsx, etc.