NodeJs problem after installing Electron as global package

As shown in the video, I installed electron from npm globally and it worked fine.

But npm started throwing errors and I wasn’t able to work with my React Projects. Have to delete all npm cache and global files and reinstall nodejs.

Is there some solution to this, so I can work with both electron and react.

This was the error I was getting everytime -

npm ERR! Unexpected end of JSON input while parsing near

You can install electron locally [if you don’t want to install it globally] by

Local installation means you just want to install electron for current npm package.

npm install electron --save-dev --save-exact