微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法进行电子重建和node-gyp错误的Cant重建应用程序

如何解决无法进行电子重建和node-gyp错误的Cant重建应用程序

我在Win10上试图安装应用程序。 Win开发工具已安装了'npm install -g windows-build-tools',但我已经安装了Python 3,8 执行'npm i-D'之后也不错,但是执行'npm run rebuild'是个问题。 节点v12.18.4,node-gyp v7.1.0,Python 3.8.5

请告诉我

$ `npm run rebuild`

> ShoppingMachine@1.0.0 rebuild C:\sm\24sju-sm
> electron-rebuild

- Searching dependency tree
× Rebuild Failed

An unhandled error occurred inside electron-rebuild
Traceback (most recent call last):
  File "C:\sm\24sju-sm\node_modules\node-gyp\gyp\gyp_main.py",line 50,in <module>
    sys.exit(gyp.script_main())
  File "C:\sm\24sju-sm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py",line 554,in script_main
    return main(sys.argv[1:])
  File "C:\sm\24sju-sm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py",line 547,in main
    return gyp_main(args)
  File "C:\sm\24sju-sm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py",line 532,in gyp_main
    generator.GenerateOutput(flat_list,targets,data,params)
  File "C:\sm\24sju-sm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py",line 2015,in GenerateOutput
    generator_flags))
  File "C:\sm\24sju-sm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py",line 950,in _GenerateProject
    return _GenerateMSBuildProject(project,options,version,generator_flags)
  File "C:\sm\24sju-sm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py",line 3396,in _GenerateMSBuildProject
    easy_xml.WriteXmlIfChanged(content,project.path,pretty=True,win32=True)
  File "C:\sm\24sju-sm\node_modules\node-gyp\gyp\pylib\gyp\easy_xml.py",line 123,in WriteXmlIfChanged
    xml_string = xml_string.encode(encoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc8 in position 2795: ordinal not in range(128)
gyp ERR! configure error
gyp ERR! stack Error: `gyp` Failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\sm\24sju-sm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\sm\\24sju-sm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=9.1.1" "--arch=x64" "--dist-url=https://www.electronjs.org/headers" "--build-from-source"
gyp ERR! cwd C:\sm\24sju-sm\node_modules\@serialport\bindings
gyp ERR! node -v v12.18.4
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok

Failed with exit code: 1

Error: Traceback (most recent call last):
  File "C:\sm\24sju-sm\node_modules\node-gyp\gyp\gyp_main.py",in WriteXmlIfChanged
    xml_string = xml_string.encode(encoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc8 in position 2795: ordinal not in range(128)
gyp ERR! configure error
gyp ERR! stack Error: `gyp` Failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\sm\24sju-sm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\sm\\24sju-sm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=9.1.1" "--arch=x64" "--dist-url=https://www.electronjs.org/headers" "--build-from-source"
gyp ERR! cwd C:\sm\24sju-sm\node_modules\@serialport\bindings
gyp ERR! node -v v12.18.4
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok

Failed with exit code: 1
    at SafeSubscriber._error (C:\sm\24sju-sm\node_modules\spawn-rx\lib\src\index.js:267:84)
    at SafeSubscriber.__tryOrUnsub (C:\sm\24sju-sm\node_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.error (C:\sm\24sju-sm\node_modules\rxjs\internal\Subscriber.js:156:26)
    at Subscriber._error (C:\sm\24sju-sm\node_modules\rxjs\internal\Subscriber.js:92:26)
    at Subscriber.error (C:\sm\24sju-sm\node_modules\rxjs\internal\Subscriber.js:72:18)
    at MapSubscriber.Subscriber._error (C:\sm\24sju-sm\node_modules\rxjs\internal\Subscriber.js:92:26)
    at MapSubscriber.Subscriber.error (C:\sm\24sju-sm\node_modules\rxjs\internal\Subscriber.js:72:18)
    at SafeSubscriber._next (C:\sm\24sju-sm\node_modules\spawn-rx\lib\src\index.js:242:65)
    at SafeSubscriber.__tryOrUnsub (C:\sm\24sju-sm\node_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.next (C:\sm\24sju-sm\node_modules\rxjs\internal\Subscriber.js:143:22)
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! ShoppingMachine@1.0.0 rebuild: `electron-rebuild`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the ShoppingMachine@1.0.0 rebuild 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:

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。