1
votes

I installed react-native globally and confirmed installation on Windows 10. Then I ran react-native command in PowerShell to install materials-kit and vector-icons. The installation of these packages failed and the directory is no longer considered a react-native project directory. I have to reinstall react-native as a result.

How can I install materials-kit and vector-icons without causing the system to uninstall react-native?

Steps Taken

I ran the below code in PowerShell. Please Note: I also used MS Visual Code and the Terminal in MS Studio Code.

Input

npm install -g react-native-cli

react-native -version

Output

react-native-cli: 2.0.1

react-native: 0.59.5

Additional Input

npm install --save react-native-material-kit react-native-vector-icons

react-native -version

Additional Ouput

react-native-cli: 2.0.1

react-native: n/a - not inside a React Native project directory

I was expecting these two react-native packages to be installed. Did not happen.

Extra Information: Error Code Snippet

...

npm ERR! code EPERM

npm ERR! errno -4048

npm ERR! syscall rename

...

npm ERR! The operation was rejected by your operating system.

npm ERR! It's possible that the file was already in use (by a text editor or antivirus),

npm ERR! or that you lack permissions to access it.

2

2 Answers

1
votes

you have to create a project with the react-native-cli then add your required packages there. so the steps should be like this:

  1. install the cli tool as you've done it very well.

    npm install -g react-native-cli

  2. create a project (you need to provide a name for it).

    react-native init *<project_name>*

  3. change your current directory to the created project

    cd *<project_name>*

  4. install your favorite packages.

    npm install --save react-native-material-kit react-native-vector-icons

  5. run the react-native packager for your target platform (ios or android)

    react-native run-ios

or

`react-native run-android`

happy coding!

0
votes

I solved the program by starting again with no active react-native directory.

1. decided to use Expo to expedite the react-native application set-up process

npm install expo-cli --global

2. initialised new project && changed directory

expo init cra

cd cra

3. installed the react-native material-kit and vector-icons packages individually using yarn instead of npm

yarn add react-native-material-kit

yarn add react-native-vector-icons

4.confirmed installation

Input

react-native -version

Output

react-native-cli: 2.0.1

react-native: 0.57.1