2

I have installed react native using ::

expo init AwesomeProject

Everything works fine, untill I install and NPM package. I created three pages without installing new package. When I installed Vector icons for react native using ::

npm i react-native-vector-icons

I get alots of warning when Command is done ::

npm WARN react-native-safe-area-view@0.11.0 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.

npm WARN react-navigation-stack@0.6.0 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.

npm WARN react-native-tab-view@0.0.77 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.

npm WARN react-native-drawer-layout-polyfill@1.3.2 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.

npm WARN react-native-drawer-layout@1.3.2 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

But package seems to be installed ::

  • react-native-vector-icons@6.1.0 added 47 packages from 29 contributors, removed 329 packages, updated 658 packages and audited 21565 packages in 83.604s found 0 vulnerabilities

After that When I run :: expo start I Get following error ::

[16:19:03] Error: React native is not installed. Please run `npm install` in your project directory.
[16:19:03] Couldn't start project. Please fix the errors and restart the project.

Now as per error i ran npm install and then expo start.

everything seems to be fine, project starts running on expo emulator. BUT when I edit anything and save it produces another error ::

Error
16:25
undefined
Error
16:25
Building JavaScript bundle: error
Info
16:25
Building JavaScript bundle: 99%

and emulator turns red with unclear error as in screenshot attached: Is there any mistake I made that produced that error. Please let me know the fix so that I can install npm packages run with react native. Help appriciated

enter image description here

2 Answers2

0

Possible solutions may work.

I.Try to restart the node server which is hosting the app, right now.

II. Delete node_modules then npm install.

III. Reset the cache npm start -- --reset-cache.

IV. Remove react-native-vector-icons from package.json and try with npm install react-native-vector-icons --save

Sateesh Yemireddi
  • 4,289
  • 1
  • 20
  • 37
  • Thank you for your reply @Sateesh. I have tried deleting and running command again. reset cache as well. I will try the last one. – Maninder Singh Nov 29 '18 at 07:59
0

Quick solution add --save to your command :

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

why you need --save :

What is the --save option for npm install?