How Can I Fix This Npm Error Installing Electron?

When I use npm install electron -g, I get this error:

npm ERR! code EEXIST
npm ERR! path /usr/local/bin/electron
npm ERR! Refusing to delete /usr/local/bin/electron: ../lib/node_modules/electron-prebuilt/cli.js symlink target is not controlled by npm /usr/local/bin
npm ERR! File exists: /usr/local/bin/electron
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-03T23_17_02_469Z-debug.log

1 Answer

You need to delete the electron folder from /usr/local/bin . Then try to install Electron again:

sudo rm -rf /usr/local/bin/electron 
sudo npm install -g electron  
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest