Can't install Electron via npm?


#1

Anyone know why I can’t install electron?

C:\>npm i electron@1.8.2-beta.3

> electron@1.8.2-beta.3 postinstall C:\node_modules\electron
> node install.js
npm WARN saveError ENOENT: no such file or directory, open 'C:\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\package.json'
npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No README data
npm WARN !invalid#1 No license field.

+ electron@1.8.2-beta.3
updated 1 package in 5.943s

#2

Because you’re trying to install it locally in a folder that isn’t a project that NPM can recognize (since there’s no package.json in C:\). You want to use npm i -g electron@1.8.2-beta.3 to install it globally.


#4

I just did this first “npm init --yes”. then it installed too. I also did what your had now its installed twice.

Directory of C:\node_modules\electron\dist
Directory of C:\Users\Name\AppData\Roaming\npm\node_modules\electron\dist

Should I uninstall one? how do I remove one of them? which one is global?


#5

You don’t want C:\ to be a project folder, trust me. You should delete C:\node_modules and C:\package.json.

Global modules are stored in AppData\ so that they’re accessible from everywhere on your computer.