我的npm版本是3.10.10
节点版本是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! 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
答案 0 :(得分:0)
除非您先创建包(--save-dev
或手动编写npm init
,否则无法将模块添加到正在编写的包的依赖项(package.json
)中})。
...但是不要让你的包的根目录成为你自己的主目录。为它创建一个目录。