Adding redux and other packages to an Expo project


#1

Hi Guys! I am rather new to Expo XDE and I’ve run into some problems. I am unable to install any other packages (etc. redux and react-native-elements) to my project. Every time I’ve tried to install a package using npm install --save redux/whatever it’s deleted tons of packages and made teh expo XDE unable to run.

Could anyone explain to me how to proceed? I’ve read the documentation and searched online for several hours but have been unable to find a solution.

Is it so that I am unable to install additional packages to Expo XDE? How do I know which? If so, where are the preinstalled packages? I find it hard to believe that e.g. redux is not included with Expo XDE…

Perhaps there is something i’ve misunderstood, please help me in getting some clarity into the situation.

Regards,
Tim


#2

I suspect what’s going on is that you’re using npm 5, which looks at a file called package-lock.json to determine what packages it expects your app to have installed. Expo projects don’t come with package-lock.json, so when you add a package with npm 5, it may be deleting all your packages. I this is the case, we recommend using npm 4 (npm i -g npm@^4), using Yarn (this is what the Expo team and React Native core developers use), or first running npm install to generate package-lock.json and then trying to add new packages.

You definitely can use npm packages with Expo projects. Expo doesn’t come with Redux since we give that option to the developer.

The pre-installed packages are listed under dependencies and devDependencies in package.json and actually reside under node_modules.


#3

That was the problem! It’s solved now. Thank you very much!

Den ons 17 jan. 2018 22:46James Ide expo@discoursemail.com skrev:


closed #4

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.