2017-01-03 106 views
0
电子

我NPM版本3.10.10无法在Ubuntu的安装

和节点版本是v7.2.1

,当我试图通过在Ubuntu安装电子:

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! [email protected] postinstall: node install.js 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] 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 
+0

为什么当你没有在全局安装模块时,以root身份运行'npm'? – Quentin

+0

我想你没有'package.json'文件。 '--save-dev'标志将安装后的软件包添加到json文件中。尝试创建'package.json'文件。 – Prashanth

+0

你会建议在哪里添加文件.. –

回答

0

您不能将模块添加到您正在编写的包的依赖项(--save-dev),除非您首先创建一个包(使用npm init或手动编写package.json)。

...但不要将您的软件包的根目录作为自己的主目录。为它创建一个目录。