I have installed react-native and tried to run my app, but I immediately get the error Unrecognized font family 'simple-line-icons'.
Then, I tried to link react-native-vector-icons as mentioned in other solutions in stack-overflow or GitHub. Here's the command I tried to link it : react-native link react-native-vector-icons.
This prompt another error, which is : Cannot read property 'pbxprojPath' of null.
Again, I looked further if someone had a solution for this second error, and the most common answer I found is that I need to upgrade my react-native. So I did with the follow command react-native-git-upgrade but I got this error:
Error: react-native version in "package.json" (https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz) doesn't match the installed version in "node_modules" (0.57.1).
Here's my project properties :
package.json :
...
"dependencies": {
"#expo/samples": "2.1.1",
"#expo/vector-icons": "^9.0.0",
"expo": "^32.0.0",
"expo-cli": "^2.14.0",
"native-base": "^2.10.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-vector-icons": "^6.1.0",
},
...
app.json :
...
"expo": {
...
"sdkVersion": "32.0.0",
...
...
I have already tried to clean my cache.
Also, I am working with npm.
Has someone encountered the same problem?
Related
Problem:
Running the command npm run watch throws and error
54% building 35/41 modules 6 active /app/docroot/themes/custom/mytheme/node_modules/css-loader/index.js??ref--10-2!/app/docroot/themes/custom/mytheme/node_modules/postcss-loader/src/index.js??postcss5!/app/docroot/themes
ERROR Failed to compile with 1 errors 1:25:50 AM
error
Cannot read property 'map' of undefined
15 assets
ERROR in Cannot read property 'map' of undefined
[Browsersync] Proxying: https://ps.lndo.site
The Error happens only when the following code is included in my webpack.mix.js file:
mix.imagemin({
patterns: [{
from: '**/*.{png,gif,jpg,jpeg,svg}',
to: 'images/',
context: 'src/images/'
}, {
from: '**/*.{png,gif,jpg,jpeg,svg}',
to: 'images/',
context: 'src/components/'
}]
});
Removing the above snippet removes the error but the previous developers on this project had this for a reason.
I recently updated due to security vulnerabilities and managed to debug a different issue that Copy Plugin introduced a breaking change (already updated in the code above). However I am unsure that I have all of the configuration correct.
This I have tried:
From the command line
rm -rf node_modules
rm package.lock
npm cache clean --force
npm install
These are the packages in package.json current as of August 27, 2020
"devDependencies": {
"bootstrap": "^4.3.1",
"browser-sync": "^2.26.12",
"browser-sync-webpack-plugin": "^2.2.2",
"copy-webpack-plugin": "^6.0.3",
"cross-env": "^7.0.2",
"husky": "^4.2.5",
"imagemin-webpack-plugin": "^2.4.2",
"jquery": "^3.5.1",
"laravel-mix": "^5.0.4",
"laravel-mix-imagemin": "^1.0.3",
"popper.js": "^1.16.1",
"pretty-quick": "^2.0.1",
"resolve-url-loader": "^3.1.1",
"sass": "^1.26.10",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
},
"dependencies": {
"throttle-debounce": "^2.3.0"
}
The packages updated were the following
"browser-sync": "^2.26.7",
"copy-webpack-plugin": "^5.1.1",
"husky": "^4.2.3",
"jquery": "^3.5.0",
"sass": "^1.26.3",
"throttle-debounce": "^2.1.0"
To me this looks like a bug in the laravel-mix-imagemin plugin. Its NPM page says that "The patterns parameter is automatically converted to an array". But this doesn't comply with the copy-webpack-plugin^6 you are using (which is used under the hood by laravel-mix-imagemin), as version 6 doesn't accept an array anymore. (Too bad the laravel-mix-imagemin plugin doesn't list its dependencies and their versions properly ...)
BTW: I had basically the same issue, and the error message you get is a catastrophe.
You might be having a problem respect of the version of webpack. This is the best guess I can make. If this code worked before, then this could be a possibility.
Did not find a great answer, for now just removed imagemin configuration from webpack mix. Fixes the compile issue but does not resolve my original question.
I am trying to create a debug build of my app in react-native. It worked previously and the problem started after I used react-native-tools extension package for VSCode text editor and attached its debugger for debugging. The error doesn't occur when I create a release build. I have removed the extension, removed my project node_modules folder and reinstalled.
The error is as follows:
08-30 13:15:42.896 6228-6491/? E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
08-30 13:15:42.957 25112-25112/? E/art: Failed to send JDWP packet APNM to debugger (-1 of 51): Broken pipe
08-30 13:15:42.961 25112-25118/? E/art: Failed sending reply to debugger: Broken pipe
08-30 13:15:43.052 25112-25138/? E/Theme: Different package name.com.namahapp,com.google.android.gms
08-30 13:15:43.110 25112-25151/? E/AbstractTracker: Can't create handler inside thread that has not called Looper.prepare()
08-30 13:15:43.155 18392-18909/? E/Theme: Different package name.com.facebook.katana,com.google.android.gms
08-30 13:15:43.246 18666-22557/? E/NetworkScheduler: Invalid component specified.
08-30 13:15:43.332 25112-25165/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.namahapp, PID: 25112
java.lang.NoClassDefFoundError: com.facebook.react.modules.fresco.SystraceRequestListener
at com.facebook.react.modules.fresco.FrescoModule.getDefaultConfigBuilder(FrescoModule.java:149)
at com.facebook.react.modules.fresco.FrescoModule.getDefaultConfig(FrescoModule.java:138)
at com.facebook.react.modules.fresco.FrescoModule.initialize(FrescoModule.java:101)
at com.facebook.react.bridge.ModuleHolder.doInitialize(ModuleHolder.java:198)
at com.facebook.react.bridge.ModuleHolder.markInitializable(ModuleHolder.java:86)
at com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceInitialized(NativeModuleRegistry.java:123)
at com.facebook.react.bridge.CatalystInstanceImpl$2.run(CatalystInstanceImpl.java:387)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:152)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:818)
The react-native version is 0.55.4.
My package.json file is:
{
"name": "NamahApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-check-app-install": "0.0.4",
"react-native-fbsdk": "^0.7.0",
"react-native-firebase": "^4.2.0",
"react-native-keyboard-aware-scroll-view": "^0.6.0",
"react-native-linear-gradient": "^2.4.0",
"react-native-shadow": "^1.2.2",
"react-native-share": "^1.0.27",
"react-native-snap-carousel": "^3.7.2",
"react-native-sound": "^0.10.9",
"react-native-svg": "^6.5.0",
"react-navigation": "^2.0.1",
"socketcluster-client": "^13.0.0"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./app/assets/fonts/"
]
}
}
I can't make out what the error is and how to address it. Any help is appreciated. Thanks.
Update 31/08/2018
I opened the file with the error and found that the file is available in two places:
C:\Users\Nikhil\.gradle\caches\modules-2\files-2.1\com.facebook.react\react-native\0.12.0\8a53a72920675231a5d11880ae3cacb9ab91b93c\react-native-0.12.0-sources.jar!\com\facebook\react\modules\fresco\FrescoModule.java in Users folder (Windows).
G:\path\to\project\node_modules\react-native\android\com\facebook\react\react-native\0.55.0\react-native-0.55.0-sources.jar!\com\facebook\react\modules\fresco\FrescoModule.java
Out of those the file in Users folder does not have the SystraceRequestListener.java file.
Also, the react-native version in the path is 0.12.0. How is this getting set?? How do I change this?? I guess it should have been 0.55.4 i.e. current react-native version used in the project.
Where should I do the changes?? In Project?? or in Android studio base settings??
Please help...
Update-2 31/08/18
Removed the .gradle/cache file from Users folder but the error still persists.
Now the error is definitely in the .gradle folder in the project.
Now need to determine why the error occurs even as the SystraceRequestListener.java exists in the same folder as the file in which the error occurs i.e. FrescoModule.java.
Update 03/09/18 (3rd Sept)
I reinstalled and configured all the npm packages used in the project to find when the build gets the above error, and I found that the issue occurs when I install react-native-firebase. Will update if I find some solution.
The error was emerging from the react-native-firebase package.
Updating the react-native-firebase package to the latest version resolved my problem.
Bundling index.js [development, non-minified] 0.0% (0/1), failed.
error: bundling failed: Error: Cannot find module '#babel/core' (While processing preset:
Others have had similar problems which were solved by one of the following:
Uninstalling babel-preset-react-native and installing it again #2.1.0.
Some people could only fix this using yarn and not npm
Moving Babel to devDependancies
Updating the .babelrc file with
{
"presets": [
"react-native"
],
"env": {
"development": {
"plugins": [
"transform-react-jsx-source"
]
}
}
}
Unfortunately, not a single one of these worked for me. This happened right after I installed "react-native-svg": "^6.4.1" and "react-native-svg-charts": "^5.2.0".
My package.json is
"dependencies": {
"react": "16.0.0",
"react-native": "0.51.0",
"react-native-svg": "^6.4.1",
"react-native-svg-charts": "^5.2.0",
"react-navigation": "^1.5.11",
"react-navigation-redux-helpers": "^1.0.5",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
"redux-persist": "^5.4.0"
},
"devDependencies": {
"#babel/core": "^7.0.0-beta.52",
"babel-jest": "23.2.0",
"babel-loader": "^7.1.5",
"gulp-babel": "^7.0.1",
"babel-preset-react-native": "2.1.0",
"jest": "23.3.0",
"react-test-renderer": "16.4.1"
},
"jest": {
"preset": "react-native"
}
I've tried a few other things as well, i've removed the node_modules directory about 150 times and reinstalled. always the same error. I've installed #babel/core and babel-core. I've changed the version numbers, i've moved them around from dependencies to devDependencies and back again. nothing is working.
When I do npm install - everything seems to install just fine
When I do react-native run-android it runs through the code, loads it onto the emulated device
Installing APK 'app-debug.apk' on 'Nexus_6_API_28(AVD) - 9' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL
Total time: 10.373 secs
However, immediately after that, when it runs on the device I receive the red screen of death.
Bundling index.js [development, non-minified] 0.0% (0/1), failed.
error: bundling failed: Error: Cannot find module '#babel/core' (While processing preset: "/Code/nr/node_modules/babel-preset-react-native/index.js")
Well, after a few hours it seems that at least one of the above DID work. the remaining issue was closing the Metro Bundler terminal and starting a new one. Thanks to a comment on the accepted answer from TransformError with babel-preset-react-native/index.js
Im not sure why I'm getting this error:
Unable to resolve module `#expo/vector-icons` from `...(directory path here)...` : Module does not exist in the module pack
I have tried the following things suggested on other forums/sites:
Clear watchman watches
Deleting the node_modules folder
Reset packager cache
package.json
{
"name": "app name",
"version": "0.0.0",
"description": "Hello Expo!",
"author": null,
"private": true,
"main": "node_modules/expo/AppEntry.js",
"dependencies": {
"babel-plugin-module-resolver": "^2.5.0",
"babel-preset-expo": "^4.0.0",
"expo": "^21.0.0",
"firebase": "^4.5.1",
"geofire": "^4.1.2",
"moment": "^2.19.1",
"react": "16.0.0-alpha.12",
"react-native": "https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz",
"react-navigation": "^1.0.0-beta.13"
}
}
But still nothing, still getting this error
I resolved the issue by this command npm install #expo/vector-icons --save
I ran into the same issue. It's the babel-preset-expo. uninstall that and do the following
npm i metro-react-native-babel-preset --save-dev
delete the babel.config.json and create a new file called .babelrc
then specify the preset
{
"presets": ["module:metro-react-native-babel-preset"]
}
Sounds like vector-icons is another library you should be declaring in your package.json (https://www.npmjs.com/package/#expo/vector-icons)
Command npm install #expo/vector-icons --save do the trick !
The reason why I had this error, was because when I put useState in my app, VS Code auto imported it from react-native-vector-icons/node_modules/#types/react, instead of from "react"
I'm trying to learn react-native by creating an app using the expo development environment. I had a working app (little more than the code that shipped with expo) until installing redux. Currently I am getting the following error from the XDE:
Problem checking node_modules dependencies: Unexpected end of JSON input
and the following from the ios simulator:
undefined is not an object (evaluating 'ReactPropTypes.string')
Package.json:
{
"name": "myApp",
"version": "0.0.0",
"description": "Hello Expo!",
"author": null,
"main": "main.js",
"scripts": {
"test": "node node_modules/jest/bin/jest.js"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/ex-navigation": "~3.0.0",
"#expo/samples": "~1.0.3",
"babel-preset-react": "^6.24.1",
"expo": "17.0.0",
"react": "^16.0.0-alpha.12",
"react-native": "^0.45.1",
"react-redux": "^5.0.5",
"redux": "^3.6.0"
},
"devDependencies": {
"jest-expo": "~1.0.1"
}
}
I believe my node modules contain valid JSON. It should be noted that I'm using a more current version of react-native than expo. Is this an issue with the packages I have installed? Which files would be helpful in solving this?
Although I haven't been able to fix this particular error. This one and many others can be avoided by using yarn instead of npm when working with expo (I have no affiliation with either tool).
I believe this is due to a bug in the current release of npm 5. As mentioned in the other answer here, using npm 4 or yarn will resolve this problem.