I am using an ubuntu os and each time I try to create a new react app without adding sudo, I get this error:
Creating a new React app in /home/bunny/bunny.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Unexpected end of JSON input while parsing near '...jUJStbKRw4Wj3LhB5a/JP'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/bunny/.npm/_logs/2020-12-31T13_36_25_597Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting bunny/ from /home/bunny
Done.
If I use sudo in creating the react app successfully, I would have to input my password everytime I want to save a changes made in a file, add a new folder or file or even delete files and I can only add new files from the terminal.
I have searched for a solution to this and the last thing I tried was changing the owner of the directory so I could modify or create an app without the sudo priviledges and I did this:
sudo chown -R bunny:staff '/home/bunny/.npm/'
This doesn't seem to work either. I need help because inputing a password everytime and creating files from the terminal is now frustrating