Unexpected Token - After updating dependencies in react native to latest versions - reactjs

I am trying to import a very old react-native project. I updated the expo version to 36 and updated almost the dependencies to the latest version. It was a working code but upon running now, I get the following error in the below line
Unexpected token (59:18)
57 | navigationOptions:{
58 | drawerLabel: "Change Format",
> 59 | drawerIcon: <Icon name="list" size={20} color={TXT_COLOR_PRIMARY} />,
| ^
60 | },
61 | },
62 | Stops :{
Failed building JavaScript bundle.
Please find my App.js file
{
"name": "AwesomeProject",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-env": "^1.7.0",
"flow-bin": "^0.41.0",
"jest-expo": "36.0.0",
"react-native-scripts": "^1.14.1",
"react-test-renderer": "16.3.0-alpha.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest",
"flow": "flow"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"core-js": "^3.6.4",
"create-react-class": "^15.6.3",
"eslint-cli": "^1.1.1",
"expo": "^36.0.0",
"material-ui": "^0.20.0",
"native-base": "^2.13.12",
"react": "^16.8.3",
"react-dom": "^16.4.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-audio-player-recorder-no-linking": "^1.0.2",
"react-native-elements": "^1.2.7",
"react-native-fetch-blob": "^0.10.8",
"react-native-file-uploader": "0.0.2",
"react-native-flexi-radio-button": "^0.2.2",
"react-native-material-buttons": "^0.6.0",
"react-native-material-ui": "^1.30.1",
"react-native-permissions": "^2.0.10",
"react-native-radio-button": "^2.0.1",
"react-native-simple-radio-button": "^2.7.4",
"react-native-sound": "^0.11.0",
"react-native-sound-player": "^0.10.4",
"react-native-sound-recorder": "^1.3.4",
"react-native-table-component": "^1.2.1",
"react-native-tts": "^3.1.1",
"react-native-upload-file": "^0.1.1",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^4.3.0",
"react-timer-mixin": "^0.13.4"
}
}
Import statements in App.js
import React from 'react';
import {View, Text, StyleSheet,Image, TouchableHighlight} from 'react-native';
import {Radio, Right, ListItem} from 'native-base';
import { Icon } from 'react-native-elements';
import { TextButton, RaisedTextButton } from 'react-native-material-buttons';
import { StackNavigator,DrawerNavigator } from 'react-navigation'; // Version can be specified in package.json
import { Button, ThemeProvider } from 'react-native-material-ui';
import HomeScreen from './Screens/HomeScreen';
import Screen2 from './Screens/Screen2';
import Screen3 from './Screens/Screen3';
import Screen4 from './Screens/Screen4';
import Settings from './Screens/Settings';
import Stop_Info_Screen from './Screens/Stop_Info_Screen';
import AboutUsScreen from './Screens/AboutUs';
import FeedbackScreen from './Screens/Feedback';
import DrawerContent from './Additional_Components/SideDrawer'
import styles from './Styles/commonStyles';
import {COLOR_PRIMARY,COLOR_SECONDARY,TXT_COLOR_PRIMARY,TXT_COLOR_SECONDARY,DARK_PRIMARY_COLOR} from './constants';
I started working on react native only from yesterday. I apologize if this is silly. I tried googling this but I believe it is a very generic error. Any help will be highly appreciated.

Related

with expo after Web Bundling complete , showing blank page

i followed a tutorial for adding web support using to a expo project **. using typescript, react-native-web and webpack. looks like it works for everyone. but for me, i get a blank web page after Web Bundling complete.
Started Metro Bundler
Web Bundling complete
even though it works just fine on the emulator. i get no error in the console.
package.json:
{
"name": "imibonano",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --watchAll",
"deploy": "gh-pages -d web-build",
"predeploy": "expo build:web",
"commit": "node scripts/github.js"
},
"dependencies": {
"#expo-google-fonts/poppins": "^0.2.2",
"#expo/webpack-config": "^0.16.24",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/slider": "4.2.1",
"#react-native-firebase/app": "^14.2.3",
"#react-native-picker/picker": "2.4.0",
"#react-navigation/bottom-tabs": "^6.0.9",
"#react-navigation/material-bottom-tabs": "^5.3.15",
"#react-navigation/native": "^6.0.6",
"#react-navigation/native-stack": "^6.2.5",
"#react-navigation/stack": "^6.0.11",
"dotenv": "^14.2.0",
"expo": "~45.0.0",
"expo-app-loading": "^2.0.0",
"expo-cli": "^5.4.8",
"expo-font": "~10.1.0",
"expo-google-app-auth": "^8.1.7",
"expo-linear-gradient": "~11.3.0",
"expo-modules-core": "~0.9.2",
"expo-splash-screen": "^0.15.1",
"expo-status-bar": "~1.3.0",
"firebase": "^9.6.4",
"jest": "^28.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-custom-swiper": "^1.0.16",
"react-native-flipper": "^0.146.1",
"react-native-gesture-handler": " ~2.2.1",
"react-native-pager-view": "5.4.15",
"react-native-paper": "^4.7.2",
"react-native-reanimated": "~2.8.0",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-swiper-flatlist": "^3.0.16",
"react-native-vector-icons": "^8.1.0",
"react-native-web": "0.17.7",
"react-native-web-swiper": "^2.2.2",
"react-query": "^3.39.1",
"react-query-native-devtools": "^4.0.0",
"react-redux": "^8.0.2"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#types/react": "~17.0.21",
"#types/react-native": "~0.66.13",
"ts-node": "^10.8.1",
"typescript": "^4.7.3"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"private": true
}
app.tsx:
import { StatusBar } from "expo-status-bar";
import React from "react";
import NavigationStack from "./navigation/NavigationStack";
import Providers from "./navigation/index";
import useCachedResources from './hooks/useCachedResources';
import useColorScheme from './hooks/useColorScheme';
import AppLoading from 'expo-app-loading';
import { AuthProvider } from "./navigation/AuthProvider";
import { SafeAreaView, StyleSheet, Text } from "react-native";
import AppNavigation from './navigation';
import {
useFonts,
// Poppins_100Thin,
// Poppins_100Thin_Italic,
// Poppins_200ExtraLight,
// Poppins_200ExtraLight_Italic,
// Poppins_300Light,
// Poppins_300Light_Italic,
Poppins_400Regular,
// Poppins_400Regular_Italic,
Poppins_500Medium,
// Poppins_500Medium_Italic,
Poppins_600SemiBold,
// Poppins_600SemiBold_Italic,
// Poppins_700Bold,
// Poppins_700Bold_Italic,
// Poppins_800ExtraBold,
// Poppins_800ExtraBold_Italic,
// Poppins_900Black,
// Poppins_900Black_Italic
} from '#expo-google-fonts/poppins';
export default function App() {
const isLoadingComplete = useCachedResources();
const colorScheme = useColorScheme();
const [loaded] = useFonts({
title: require('./assets/fonts/klarissa.regular.ttf'),
Poppins_400Regular,
Poppins_600SemiBold,
Poppins_500Medium
});
if (!isLoadingComplete || !loaded) {
return <AppLoading />;
} else {
return <Providers />;
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#0a0a0a",
alignItems: "center",
justifyContent: "center",
}
})
index.js:
import React from "react";
import { SafeAreaView, StyleSheet, Text } from "react-native";
import { AuthProvider } from "./AuthProvider";
import NavigationStack from "./NavigationStack";
export default function Providers() {
return (
<AuthProvider>
<SafeAreaView style={styles.container}>
<NavigationStack />
</SafeAreaView>
</AuthProvider>
);
}

Type error Module '"react-leaflet"' has no exported member 'useEventHandlers'

I have nextjs app + typescript + react-leaflet
when I start my development server npm run dev it's fine there is no error,
but when I start build with npm run build I have an error, it says.
Type error: Module '"react-leaflet"' has no exported member 'useEventHandlers'.
1 | import { useMemo, useCallback, useState } from 'react'
> 2 | import { useMap, useMapEvent, useEventHandlers, MapContainer } from 'react-leaflet'
| ^
3 |
4 | // Classes used by Leaflet to position controls
5 | const POSITION_CLASSES = {
info - Checking validity of types .
Here's my package.json file.
{
"name": "spot-nearby",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"#types/leaflet": "^1.7.0",
"#types/react-leaflet": "^2.8.1",
"axios": "^0.21.1",
"csv-parser": "^3.0.0",
"leaflet": "^1.7.1",
"leaflet-geosearch": "^3.3.2",
"next": "10.2.3",
"papaparse": "^5.3.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-leaflet": "^3.2.0",
"react-leaflet-search": "^2.0.1",
"react-loader-spinner": "^4.0.0",
"react-papaparse": "^3.14.0",
"react-search-field": "^1.2.1"
},
"devDependencies": {
"#types/react": "17.0.8",
"typescript": "4.3.2"
}
}
I already install #types/react-leaflet, but why did this happened?
react-leaflet in fact does not export useEventHandlers method. It's a method from #react-leaflet/core package. It's a dependency of react-leaflet package and must be installed along with it. And should be imported from there:
import { useMap, useMapEvent, MapContainer } from 'react-leaflet'
import { useEventHandlers } from '#react-leaflet/core'

React build - not found: Error: Can't resolve 'buffer'

I am having an error when I build my application in react. I noticed this error only when I tried to build application.
When I stopped dev server and ran it again, it showed the same error. It seems that I made some change that only showed when I started the server again or make build:
Module not found: Error: Can't resolve 'buffer' in '\node_modules\htmlparser2\lib' BREAKING CHANGE: webpack < 5
used to include polyfills for node.js core modules by default.This is
no longer the case. Verify if you need these module and configure a
polyfill for it.
If you want to include a polyfill, you need to install 'buffer'. If
you don't want to include a polyfill, you can use an empty module like
this:
resolve.alias: { "buffer": false }
error Command failed with exit code 1.
My application is made in CRA and Typescript. This is my package.json:
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "react-scripts start",
"build": "cross-env NODE_OPTIONS='--max-old-space-size=4096' react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"dependencies": {
"#apollo/react-hooks": "^4.0.0",
"#date-io/moment": "^1.3.13",
"#material-ui/core": "^4.11.0",
"#material-ui/icons": "^4.9.1",
"#material-ui/lab": "^4.0.0-alpha.56",
"#material-ui/pickers": "^3.2.10",
"#optimizely/react-sdk": "^2.4.0",
"apollo-boost": "^0.4.9",
"classnames": "^2.2.6",
"formik": "^2.2.5",
"graphql": "^15.4.0",
"lodash": "^4.17.20",
"moment": "^2.29.1",
"react": "^16.13.1",
"react-app-polyfill": "^2.0.0",
"react-dom": "^16.13.1",
"react-google-recaptcha": "^2.1.0",
"react-masonry-css": "^1.0.14",
"react-router-dom": "^5.2.0",
"react-test-renderer": "^16.13.1",
"react-toastify": "^6.1.0",
"reset-css": "^5.0.1",
"use-debounce": "^5.1.0"
},
"devDependencies": {
"#testing-library/jest-dom": "^5.11.6",
"#testing-library/react": "^11.2.1",
"#testing-library/user-event": "^12.2.2",
"#types/classnames": "^2.2.11",
"#types/enzyme": "^3.10.8",
"#types/enzyme-adapter-react-16": "^1.0.6",
"#types/jest": "^26.0.15",
"#types/lodash": "^4.14.165",
"#types/moment": "^2.13.0",
"#types/node": "^14.14.9",
"#types/react": "^16.9.56",
"#types/react-dom": "^16.9.9",
"#types/react-google-recaptcha": "^2.1.0",
"#types/react-router-dom": "^5.1.6",
"cross-env": "^7.0.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"enzyme-to-json": "^3.6.1",
"husky": "^4.3.0",
"jest-dom": "^4.0.0",
"jest-sonar-reporter": "^2.0.0",
"lint-staged": "^10.5.1",
"node-sass": "^5.0.0",
"prettier": "^2.2.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2"
}
}
You need to install the buffer package
npm install buffer
You have to Install this
npm install assert browserify-zlib buffer process stream-browserify util .
it will help you out
I found a solution to my problem. It is a bit weird that it didn't show up as test error.
SOLUTION
To solve this I just replaced location of TEST_ID to be in my component, and that my-component.test file to import it from there:
My component
import React, { FunctionComponent } from 'react';
/* Tests */
export const TEST_ID = 'my-component-test-id';
export const MyComponent: FunctionComponent = () => {
return <div data-test-id={TEST_ID}>123</div>;
};
Test
import React from 'react';
import { cleanup } from '#testing-library/react';
import { mount } from 'enzyme';
import { TEST_ID } from './my-component';
import MyComponent from './my-component'
afterEach(cleanup);
it('Render My component and have some value', () => {
const wrapper = mount(<MyComponent />);
const myComponent = wrapper.find(`[data-testid='${TEST_ID}']`);
expect(myComponent).toHaveValue('some value');
});
Analysis
Apparently if you import some value (in my case a constant) from .test file, if you try and build your app, the mentioned error will show up.
In my case I had a component:
MyComponent
import React, { FunctionComponent } from 'react';
/* Tests */
import { TEST_ID } from './test/my-component.test';
export const MyComponent: FunctionComponent = () => {
return <div data-test-id={TEST_ID}>some value</div>;
};
The TEST_ID was imported from my-component.test file. The purpose of that constant was to have that test id set for component so I can find that element based of that test id in my test.
Test
import React from 'react';
import { cleanup } from '#testing-library/react';
import { mount } from 'enzyme';
import MyComponent from './my-component'
afterEach(cleanup);
export const TEST_ID = 'my-component-test-id';
it('Render My component and have some value', () => {
const wrapper = mount(<MyComponent />);
const myComponent = wrapper.find(`[data-testid='${TEST_ID}']`);
expect(myComponent).toHaveValue('some value');
});
you need to install 'buffer' : npm install buffer oR npm install buffer --f

React Native TypeSrcript Function Returning JSX.Element Type

I've got a TypeScript function which returns a React Native View.
import React from "react";
import JSX, {View} from "react-native";
class DummyClass {
static getView() {
return (
<View style={{flex: 1}}/>
);
}
}
export default DummyClass;
And I'm calling this function in this way:
import JSX from "react-native";
import DummyClass from "./util/dummy";
const DummyWrapper = () => {
return (DummyClass.getView());
};
export default DummyWrapper;
And when I run eslint, I get a warning.
5:5 warning Missing return type on function #typescript-eslint/explicit-module-boundary-types
So, I need to be returning something. JSX.Element seems reasonable enough, but that doesn't seem to be working. For one, when I try to return a JSX.Element, VSCode can't resolve it and pretends it's any instead. And moreover, it causes errors in other places that call the function.
So, doing this:
static getView() : JSX.Element {
and const DummyWrapper = () : JSX.Element => {
Results in the following error in DummyCaller:
5:5 error Unsafe return of an any typed value #typescript-eslint/no-unsafe-return
So now I'm not sure exactly what to do. I've tried a few other things, such as returning View, typeof View, React.Component (and typeof), and a few other things. I've also messed around with where JSX is being imported from. If I import from react, it seems to work even worse than if I import it from react-native. Also in my research, I see the most common problem is that one's React and React Native types are out of date, but as far as I can tell, I'm on the most up-to-date versions.
My packages.json:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"lint": "eslint -c .eslintrc.js --ext .tsx ."
},
"dependencies": {
"#dudigital/react-native-zoomable-view": "^1.0.15",
"#react-native-community/masked-view": "^0.1.10",
"#react-navigation/native": "^5.7.6",
"#react-navigation/stack": "^5.9.3",
"#types/react-native-vector-icons": "^6.4.6",
"change-case": "^4.1.1",
"expo": "~39.0.2",
"expo-status-bar": "~1.0.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz",
"react-native-gesture-handler": "^1.8.0",
"react-native-paper": "^4.2.0",
"react-native-reanimated": "^1.13.1",
"react-native-safe-area-context": "^3.1.8",
"react-native-screens": "^2.11.0",
"react-native-tab-view": "^2.15.2",
"react-native-vector-icons": "^7.1.0",
"react-native-web": "^0.13.18"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"#types/jest": "^26.0.15",
"#types/react": "^16.9.53",
"#types/react-dom": "^16.9.8",
"#types/react-native": "^0.63.27",
"#types/react-navigation": "^3.4.0",
"#types/react-redux": "^7.1.9",
"#types/react-test-renderer": "^16.9.3",
"#typescript-eslint/eslint-plugin": "^4.5.0",
"#typescript-eslint/parser": "^4.5.0",
"commonjs": "latest",
"eslint": "^7.11.0",
"eslint-plugin-jsdoc": "^30.7.3",
"eslint-plugin-prefer-arrow": "^1.2.2",
"eslint-plugin-react": "^7.21.5",
"react-native-typescript-transformer": "^1.2.13",
"requirejs": "latest",
"ts-jest": "^26.4.1",
"tslib": "^2.0.3",
"typescript": "^4.0.3"
},
"private": true
}
React should be putting JSX into the global namespace, so if you don't import it from anywhere then returning JSX.Element should work.
You can also import {ReactElement} from "react" and return ReactElement.
You can also import {FunctionComponent} from "react" and type the DummyWrapper function itself, not the return type, as DummyWrapper: FunctionComponent<{}>.
There's a lot of options.
But I really do not understand the use case where you would be creating an element from a static method on a class. This seems like a bad design that you should rethink. Can you make getView into a function component? Do you need the class DummyClass at all?

Gatsby - Build - WebpackError : Invariant failed

I'm having troubles building my gatsby project.
Development is working fine, but when i try to build, I get an error :
ERROR #95313
Building static HTML failed for path "/Components/Layout/Footer/"
See our docs page for more info on this error: https://gatsby.dev/debug-html
7 |
8 | if (isProduction) {
9 | throw new Error(prefix);
| ^
10 | } else {
11 | throw new Error(prefix + ": " + (message || ''));
12 | }
WebpackError: Invariant failed
- tiny-invariant.esm.js:9 invariant
[front-gatsby]/[tiny-invariant]/dist/tiny-invariant.esm.js:9:1
- react-router-dom.js:172 Object.children
[front-gatsby]/[react-router-dom]/esm/react-router-dom.js:172:132
- static-entry.js:240 Module.../../../../../front-gatsby/.cache/static-entry.js.__webpack_exports__.default
/front-gatsby/.cache/static-entry.js:240:18
- api-runner-ssr.js:19 MappingPromiseArray.PromiseArray._iterate
/front-gatsby/.cache/api-runner-ssr.js:19:1
I have no idea where to start debugging this. My website is pretty simple with some static pages and redux.
Below is my code.
I have basically a static website using redux and react router dom to navigate.
I had previously an error when building : "couldn't find the store" which is why I had to create both gatsby-browser and gatsby-ssr to enclose the Provider :
index.js:
import React, { Component } from 'react';
import './App.css';
import Navigation from './Components/Navigation'
import { library } from '#fortawesome/fontawesome-svg-core'
import { faStroopwafel, faStar, faCircle, faCheckCircle,faTimesCircle} from '#fortawesome/free-solid-svg-icons'
import 'bootstrap/dist/css/bootstrap.min.css';
class App extends Component {
render() {
library.add(faStroopwafel, faStar, faCircle, faCheckCircle, faTimesCircle)
return (
<div className="App">
<Navigation/>
</div>
);
}
}
export default App;
ReduxWrapper :
import React, { Component } from 'react';
import shop from './reducers/shop.reducer'; // importation du shop
import erreur from './reducers/erreur.reducer'; // importation du erreur
import panier from './reducers/panier.reducer'; // importation du erreur
import {Provider} from 'react-redux'; // importation du provider
import createEngine from 'redux-storage-engine-localstorage';
import {createStore, combineReducers, applyMiddleware} from 'redux'; // importation du reduceur
import * as storage from 'redux-storage'; // storage
const reducer = storage.reducer(combineReducers({shop, erreur,panier}));
const engine = createEngine('my-save-key');
const middleware = storage.createMiddleware(engine);
const createStoreWithMiddleware = applyMiddleware(middleware)(createStore);
const store = createStoreWithMiddleware(reducer);
const load = storage.createLoader(engine);
load(store);
export default ({ element }) => (
<Provider store={store}>{element}</Provider>
);
gatsby-browser & gatsby-ssr (identicals)
export { default as wrapRootElement } from './src/pages/ReduxWrapper';
My Package.json :
{
"name": "gatsby-starter-hello-world",
"private": true,
"description": "",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing \""
},
"dependencies": {
"#feathersjs/feathers": "^4.3.0-pre.1",
"#feathersjs/rest-client": "^4.3.0-pre.1",
"#fortawesome/fontawesome-svg-core": "^1.2.18",
"#fortawesome/free-solid-svg-icons": "^5.8.2",
"#fortawesome/react-fontawesome": "^0.1.4",
"bootstrap": "^4.3.1",
"emailjs-com": "^2.4.0",
"express": "^4.17.0",
"express-favicon": "^2.0.1",
"fs": "0.0.1-security",
"gatsby": "^2.15.28",
"gatsby-plugin-mailchimp": "^5.1.2",
"gatsby-plugin-react-helmet": "^3.1.10",
"gatsby-plugin-stripe": "^1.2.3",
"react": "^16.10.1",
"react-bootstrap": "^1.0.0-beta.10",
"react-dom": "^16.10.1",
"react-helmet": "^5.2.1",
"react-redux": "^7.0.3",
"react-responsive-carousel": "^3.1.49",
"react-router-dom": "^5.0.0",
"react-router-hash-link": "^1.2.1",
"react-router-hash-link-offset": "^1.0.1",
"react-scripts": "2.1.8",
"react-scroll-to-component": "^1.0.2",
"react-stripe-checkout": "^2.6.3",
"react-stripe-elements": "^4.0.0",
"reactstrap": "^7.1.0",
"redux": "^4.0.1",
"redux-storage": "^4.1.2",
"redux-storage-engine-localstorage": "^1.1.4",
"uuid": "^3.3.3"
},
"devDependencies": {
"prettier": "^1.18.2"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
This doesn't work when running "gatsby build", it stops at the step "Building static HTML for pages" and the error above is shown
I'd bet the problem is your use of redux-storage. Gatsby can't access any browser APIs during build, so you'll need to wrap a conditional check to make sure localstorage is available (per the html debugging page that has already been suggested).
I'm not familiar with redux usage in gatsby, but I would rewrite your redux wrapper to be closer to the official example, and put the redux-storage setup in a if (typeof window !== 'undefined') block

Resources