Javascript 无法在Ubuntu中安装electron

Javascript 无法在Ubuntu中安装electron,javascript,node.js,ubuntu,electron,Javascript,Node.js,Ubuntu,Electron,我的npm版本是3.10.10 节点版本为v7.2.1 当我试图通过以下方式在ubuntu中安装electron时: sudo npm install electron --save-dev 我得到的错误如下: Error: read ECONNRESET at exports._errnoException (util.js:1022:11) at TLSWrap.onread (net.js:572:26) npm WARN enoent ENOENT: no such file or d

我的npm版本是3.10.10

节点版本为v7.2.1

当我试图通过以下方式在ubuntu中安装electron时:

sudo npm install electron --save-dev
我得到的错误如下:

Error: read ECONNRESET
at exports._errnoException (util.js:1022:11)
at TLSWrap.onread (net.js:572:26)
npm WARN enoent ENOENT: no such file or directory, open '/home/dotmark/package.json'
npm WARN dotmark No description
npm WARN dotmark No repository field.
npm WARN dotmark No README data
npm WARN dotmark No license field.
npm ERR! Linux 3.13.0-87-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "electron" "--save-dev"
npm ERR! node v7.2.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! electron@1.4.13 postinstall: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.4.13 postinstall script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electron
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/dotmark/npm-debug.log

除非首先创建包(使用
npm init
或手动编写
package.json
),否则无法将模块添加到正在编写的包的依赖项中(
--save dev


…但不要将包的根目录设置为自己的主目录。为它创建一个目录。

当您没有全局安装模块时,为什么要以root用户身份运行
npm
?我想您没有
package.json
文件
--save dev
标志在安装后将已安装的软件包添加到json文件中。尝试创建
package.json
文件。您是否建议在何处添加该文件。。