1

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.

Azuloso
  • 11
  • 4

2 Answers2

1

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!

Ali Ghanavatian
  • 506
  • 1
  • 6
  • 14
  • Thank you. However, this is what I did in the beginning. I apologise for not mentioning I typed react-native init crm in the above post. I was in the crm directory when I tried to install material-kit and vector-icons. – Azuloso Apr 26 '19 at 08:15
  • obviously, your problem relates to installing node on your windows. you may consider using windows terminal instead and make sure your $PATH variable includes node installation directory. [this answer](https://stackoverflow.com/questions/27344045/installing-node-js-and-npm-on-windows-10) might help – Ali Ghanavatian Apr 26 '19 at 11:07
0

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

Azuloso
  • 11
  • 4