Currently, I am attempting to work through a basic redux example:
This particular example involves storing a number in a reducer that simply increments it. The code solely imports redux without any additional dependencies such as redux-persist or react-redux.
However, the main issue arises when trying to install all the required dependencies. Previously, running react-native apps was smooth sailing until introducing redux. Following a react-native init and executing run-ios, an error pops up indicating that redux cannot be found. Here are the steps I have attempted:
$ npm install --save redux
Unfortunately, this command caused complications as it resulted in:
added 5 packages, removed 617 packages, and updated 17 packages in 8.839s
Subsequently, run-ios or run-android ceased working and displayed:
Command
run-ios
unrecognized. Make sure you have executednpm install
and that you are inside a react-native project.
Even after multiple attempts of npm install or npm install update, no progress was made and the same error persisted.
In light of this, I decided to start afresh by creating a new project and inserting the code into index.ios.js using yarn instead (despite being unfamiliar with npm or yarn).
$ yarn add redux
Nevertheless, upon running run-ios, an error box appeared:
Can't find variable: React
The source of this error traced back to:
<Text style={{fontSize: 100}}>
thus pointing to a probable issue within react-native (specifically ReactCompositeComponent.js). As a result:
$ yarn add react
Despite this, another red box error resurfaced stating it cannot resolve react/lib/ReactDebugCurrentFrame along with a list of directories where it could not locate it.
It seems odd that npm install --save redux would cause deletion of crucial node_module files. Has anyone successfully tackled this issue?