简体   繁体   English

USB 绑定配置的电子问题?

[英]Issue in electron with Usb binding configuration?

I am facing an issue to install USB modules in my electron app.我在我的电子应用程序中安装 USB 模块时遇到问题。 When i tried to install electron and their dependency i'm getting below issues always.当我尝试安装电子及其依赖项时,我总是遇到以下问题。 Please someone help me to achieve this.请有人帮助我实现这一目标。

if any one does same thing please provide any link or instruction document it will helps me to move forwards.如果有人做同样的事情,请提供任何链接或说明文件,这将有助于我继续前进。

> master-electron@1.0.0 install C:\Users\\AppData\Roaming\npm\node_modules\master-electron
> prebuild-install || node-gyp rebuild


C:\Users\\AppData\Roaming\npm\node_modules\master-electron>if not defined npm_config_node_gyp (node "C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\ranganathan.e\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON

gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\AppData\Roaming\npm\node_modules\master-electron
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! master-electron@1.0.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the master-electron@1.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\AppData\Roaming\npm-cache\_logs\2020-02-26T13_40_04_660Z-debug.log

According logs that provided by you, It says build script can't find Python.根据您提供的日志,它说构建脚本找不到Python。 Electron uses node-gyp for build itself, that needs to install python and Visual Studio Build Tools. Electron 使用 node-gyp 进行构建,需要安装 python 和 Visual Studio Build Tools。

I recommend to you install windows-build-tools on npm .我建议你在npm上安装windows-build-tools It can installed by using command npm install --global windows-build-tools .它可以通过使用命令npm install --global windows-build-tools

The reason is that your module uses node-gyp - https://github.com/nodejs/node-gyp - and node-gyp needs platform compilers.原因是您的模块使用 node-gyp - https://github.com/nodejs/node-gyp - 而 node-gyp 需要平台编译器。 Read more about these requiremens here: https://github.com/nodejs/node-gyp在此处阅读有关这些要求的更多信息: https : //github.com/nodejs/node-gyp

If you developer box is running Windows you can install the needed compiler:如果您的开发人员盒正在运行 Windows,您可以安装所需的编译器:

npm install --global --production windows-build-tools 

@Hoto Cocoa @Hoto可可

As per your instruction, I have installed it.按照你的指示,我已经安装了。 Now that issue got solved but I am getting the below issue now.现在这个问题已经解决了,但我现在遇到了以下问题。 Can you help with this?你能帮忙解决这个问题吗?

verbose pkgid master-electron@1.0.0
verbose cwd E:\Electron\lessons\3. Main Process API\1. app
 verbose Windows_NT 10.0.17763
 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g"
 verbose node v12.14.1
 verbose npm  v6.13.6
 error code ELIFECYCLE
 error errno 1
 error master-electron@1.0.0 install: `prebuild-install || node-gyp rebuild`
 error Exit status 1
 error Failed at the master-electron@1.0.0 install script.
 error This is probably not a problem with npm. There is likely additional logging output above.
 verbose exit [ 1, true ]
npm info it worked if it ends with ok
npm verb cli [
npm verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Users\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@6.13.6
npm info using node@v12.14.1

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, fund, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    C:\Users\ranganathan.e\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.13.6 C:\Users\AppData\Roaming\npm\node_modules\npm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM