2017-01-03 149 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)。

...但不要將您的軟件包的根目錄作爲自己的主目錄。爲它創建一個目錄。