简体   繁体   中英

Unexpected end of JSON input while parsing near '…0.0“,”acorn-globals":'

Unfortunately, I'm having issues with installing react-native I get this error while installing

Unexpected end of JSON input while parsing near '...0.0","acorn-globals":'

I think the problem is with something called jest, because but when I try to install only jest, I get the same error, I don't know what jest is I'm just starting to learn react-native .

here is the log files :

393 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...0.0","acorn-globals":'
393 verbose stack     at JSON.parse (<anonymous>)
393 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)
393 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)
393 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
394 verbose cwd D:\Dev\React-Native\Sektorian
395 verbose Windows_NT 10.0.16299
396 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "jest" "babel-jest" "babel-preset-react-native" "react-test-renderer@16.3.1" "--save-dev" "--save-exact"

What do yo think the problem is ?

It seems and error related to NPM, you could try to solve it in this way:

  • clear the cache for NPM npm cache clean .
  • delete node_modules
  • reinstall your dependencies using npm install .

I had this kind of error while trying create-react-app <project_name> .

For me, this worked:

npm cache clean --force

Then I uninstalled the required package:

sudo npm uninstall -g create-react-app

Then reinstalled with --save flag and this seemed to solve the problem:

sudo install -g create-react-app --save

Hope that helps! Happy coding!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM