0

I want to install react-native-elements for my app, but after entering the install command in the cmd prompt, it gives this error :

npm ERR! Unexpected end of JSON input while parsing near '...webpack-loader":"^3.3'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DE\AppData\Roaming\npm-cache\_logs\2020-04-11T06_21_21_206Z-debug.log

And in 2020-04-11T06_21_21_206Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '--save',
1 verbose cli   'react-native-elements' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 19d809f3b42b5934
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/react-native-elements 656ms (from cache)
8 silly fetchPackageMetaData error for react-native-elements@latest Unexpected end of JSON input while parsing near '...webpack-loader":"^3.3'
9 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...webpack-loader":"^3.3'
9 verbose stack     at JSON.parse (<anonymous>)
9 verbose stack     at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\node_modules\json-parse-better-errors\index.js:7:17)
9 verbose stack     at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
9 verbose stack     at <anonymous>
9 verbose stack     at process._tickCallback (internal/process/next_tick.js:188:7)
10 verbose cwd E:\Project\test
11 verbose Windows_NT 10.0.17134
12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "react-native-elements"
13 verbose node v8.11.1
14 verbose npm  v5.6.0
15 error Unexpected end of JSON input while parsing near '...webpack-loader":"^3.3'
16 verbose exit [ 1, true ]

All other libraries are installing successfully. Only react-native-elements is giving error.

2 Answers 2

4

Try installing an older version of react-native-elements.

I resolved this issue by installing the 3.0.0 version, using npm install [email protected].

By doing just npm install react-native-elements (without the fixed version), npm was trying to install version 3.3.2 of react-native-elements.

Another option is to use the --legacy-peer-deps flag:

npm install --legacy-peer-deps

or

npm install react-native-elements --legacy-peer-deps

Sign up to request clarification or add additional context in comments.

Comments

2

First, try

npm cache clean --force

and then install react-native-elements

npm install react-native-elements

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.