问答详情
源自:3-1 创建Electron工程

electron安装失败了怎么办 百度没有找到相关案例

cmd显示如下

https://img.mukewang.com/5d47d3110001255319030298.jpg

C:\Users\51293>cnpm install -g electron

Downloading electron to C:\Users\51293\AppData\Roaming\npm\node_modules\electron_tmp

Copying C:\Users\51293\AppData\Roaming\npm\node_modules\electron_tmp\_electron@6.0.0@electron to C:\Users\51293\AppData\Roaming\npm\node_modules\electron

Installing electron's dependencies to C:\Users\51293\AppData\Roaming\npm\node_modules\electron/node_modules

[1/3] @types/node@^10.12.18 installed at node_modules\_@types_node@10.14.14@@types\node

Install fail! TypeError: this[method] is not a function

TypeError: this[method] is not a function

    at GitHost.toString (C:\Users\51293\AppData\Roaming\npm\node_modules\cnpm\node_modules\hosted-git-info\git-host.js:154:22)

    at Object.fixRepositoryField (C:\Users\51293\AppData\Roaming\npm\node_modules\cnpm\node_modules\normalize-package-data\lib\fixer.js:31:87)

    at C:\Users\51293\AppData\Roaming\npm\node_modules\cnpm\node_modules\normalize-package-data\lib\normalize.js:32:38

    at Array.forEach (<anonymous>)

    at normalize (C:\Users\51293\AppData\Roaming\npm\node_modules\cnpm\node_modules\normalize-package-data\lib\normalize.js:31:15)

    at Object.readPackageJSON (C:\Users\51293\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\utils.js:43:3)

    at readPackageJSON.next (<anonymous>)

    at onFulfilled (C:\Users\51293\AppData\Roaming\npm\node_modules\cnpm\node_modules\co\index.js:65:19)

npminstall version: 3.23.0

npminstall args: C:\Program Files\nodejs\node.exe C:\Users\51293\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\51293\.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org -g electron


提问者:Tiredclouds 2019-08-05 14:57

个回答

  • 神思者
    2019-08-05 15:38:19

    你的Node.js是最新版本么?

  • Tiredclouds
    2019-08-05 15:40:58

    稳定版