开源改变世界

无法在 win10 上构建:win-x64 #638

推推 grbl 2年前 (2023-02-03) 177次浏览
打开
9 个任务中的第 3 个
hotpoor 打开了这个问题 2020 年 8 月 25 日 · 6条评论
打开
9 个任务中的第 3 个

无法在 win10 上构建:win-x64#638

hotpoor 打开了这个问题 2020 年 8 月 25 日 · 6条评论

评论

无法在 win10 上构建:win-x64 #638
热穷 评论了 2020 年 8 月 25 日  

描述

详细描述问题或功能请求。截取屏幕截图或录制视频会有所帮助。

版本

  • CNCjs:1.9.22
  • 节点.js:10.12.0
  • NPM:6.4.1

你如何安装CNCjs?

  • NPM
  • 下载 CNCjs 桌面应用程序

数控系统

  • Grbl
  • 冰沙
  • TinyG/g2核心

硬件

  • [] 树莓派
  • 台式机或笔记本电脑
  • 移动设备

操作系统

  • [] 不适用
  • [x] 窗户
  • 苹果
  • Linux
MSI-PC@MSI MINGW64 /d/Xialiwei/github/cncjs (master)
$ npm run build:win-x64

> cncjs@1.9.22 build:win-x64 D:\Xialiwei\github\cncjs
> bash -c 'scripts/electron-builder.sh --win --x64'

/d/Xialiwei/github/cncjs/dist/cncjs /d/Xialiwei/github/cncjs
Cleaning up "/d/Xialiwei/github/cncjs/dist/cncjs/node_modules"
Installing packages...
scripts/electron-builder.sh: line 24: sudo: command not found
scripts/electron-builder.sh: line 25: sudo: command not found
/d/Xialiwei/github/cncjs
===Rebuild native modules using electron
v10.0.0
scripts/electron-builder.sh: line 29: sudo: command not found

> cncjs@1.9.22 electron-builder D:\Xialiwei\github\cncjs
> electron-builder "--win" "--x64"

  鈥?electron-builder  version=22.8.0 os=10.0.18363
  鈥?loaded configuration  file=package.json ("build" field)
  鈥?cancelled by SIGINTon dependencies  platform=win32 arch=x64 appDir=D:\Xialiwei\github\cncjs\dist\cncjs

MSI-PC@MSI MINGW64 /d/Xialiwei/github/cncjs (master)
$   猕?D:\Applications\nodejs\node.exe exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Output:

Output:

> @serialport/bindings@2.0.8 install D:\Xialiwei\github\cncjs\dist\cncjs\node_modules\@serialport\bindings
> prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild


D:\Xialiwei\github\cncjs\dist\cncjs\node_modules\@serialport\bindings>if not defined npm_config_node_gyp (node "D:\Applications\nvm\v1s\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\Applications\nvmules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
锟斤拷止锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷(Y/N)?

Error output:

Error output:
npm WARN deprecated bcrypt-nodejs@0.0.3: bcrypt-nodejs is no longer actively maintained. Please use bcrypt or bcryptjs. See https://ginode.bcrypt.js/wiki/bcrypt-vs-brypt.js to learn more about these two options
npm WARN deprecated @babel/polyfill@7.4.4: ???? This package has been deprecated in favor of separate inclusion of a polyfill and regehen needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Pleaependencies to the actual version of core-js@3.
npm WARN deprecated mkdirp@0.3.0: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API s to use Promises in 1.x.)
prebuild-install WARN install No prebuilt binaries found (target=10.0.0 runtime=electron arch=x64 libc= platform=win32)
^C^Cnpm ERR! code ELIFECYCLE
npm ERR! errno 3221225786
npm ERR! @serialport/bindings@2.0.8 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
npm ERR! Exit status 3221225786
npm ERR!
npm ERR! Failed at the @serialport/bindings@2.0.8 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\MSI-PC\AppData\Roaming\npm-cache\_logs\2020-08-25T07_24_45_747Z-debug.log
  stackTrace=
无法在 win10 上构建:win-x64 #638

我遇到了同样的问题。

无法在 win10 上构建:win-x64 #638

这不是cncjs的问题,是串口的问题。

无法在 win10 上构建:win-x64 #638

所以我一直在阅读串行端口,因为我在我的 linux 机器上遇到了同样的问题。您需要安装 python2 并在运行npm install. 您还需要确保您的机器上有 C 编译器。对于 Windows,我认为这将是一个 Visual C++ 可再发行组件。

添加这些库等应该允许@serialport/bindings 的安装后在其安装后步骤中运行编译。

@chetonWindows 和 Linux 都不再默认安装 python2,所以我猜会有越来越多的报道。我们是否应该在 README 中添加一条注释,确保您的路径上有 python2 和 ac 编译器工具链,以便安装 serialport?目前的注释只是说不要使用sudo, 。

无法在 win10 上构建:win-x64 #638

随意使用您亲自测试过的构建说明编辑或创建 wiki 页面。此类测试的一个技巧是确保您实际上是从头开始。

无法在 win10 上构建:win-x64 #638
万岁酋长 评论了 2020 年 9 月 27 日  

@MitchBradley我可能会那样做。

从头开始对我来说其实很容易。我是 octoprint-docker 的维护者,所以我有几十个系统和一个我创建的名为bootcc的程序,它允许我从任何使用 cloud-init 的发行版快速构建一个新机器。(我主要使用 Ubuntu x64 和 32 进行测试)。

现在我只是试图将它提炼成最短的可能指令,并且我还通过serialport/node-serialport#2109(评论)向 node-serialport 提供关于编译文档的潜在更新的反馈。

Windows 在 Marketplace 中有 python3,并且有一个简单的命令来安装它(必须查找它),而 Ubunut 和许多其他系统现在默认安装了 python3,但不能调用为python.

从理论上讲,您需要做的就是运行一个update-alternatives命令,这样 python 3 就可以python通过 node-gyp 调用,您就可以开始了。在 Windows 上,它应该像在终端中输入 python一样容易,然后被带到商店来设置 python。

我还没有为 python 3 和 node-gyp 测试更简单的指令集,但是我在一台新的 Ubuntu 20.04 arm64 和 armhf 机器上用 python 2 进行了测试,我在那里运行:

# update and install c toolchain and python2
$ sudo apt update -y
$ sudo apt install -y build-essential gcc g++ python2

# verify python 2 and 3 are installed
$ ls -al /usr/bin/python*
lrwxrwxrwx  1 root root              7 Apr 15 05:45 /usr/bin/python -> python2
lrwxrwxrwx  1 root root              9 Mar 13  2020 /usr/bin/python2 -> python2.7
-rwxr-xr-x     1 root root 3694632 Apr    7 07:05 /usr/bin/python2.7
lrwxrwxrwx  1 root root              9 Mar 13  2020 /usr/bin/python3 -> python3.8
-rwxr-xr-x     1 root root 5453504   Jul 16 09:00 /usr/bin/python3.8

# verify system doesn't have an alternative for `python` already configured, which is used by node-gyp to compile serialport
$ sudo update-alternatives --list python
update-alternatives: error: no alternatives for python

# set system alternatives for python command
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2

…现在 serialport 将编译并且 cncjs 将安装而不会出现错误。

我已经为 arm64 和 armhf 架构的全新 Ubuntu 安装重复了该安装,并观察到在这些步骤之前第一次失败后的成功。

不幸的是,我有大量的文档要为 octoprint-docker 编写,它们将被优先考虑,所以我现在不能花时间为此做足够的测试以有信心将该文档添加到 wiki .

希望这会帮助其他有时间能力的人完成我开始的工作,(或者当我有时间时它会留给后代)。

?

无法在 win10 上构建:win-x64 #638

不幸的是,我有大量的文档要为 octoprint-docker 编写,它们将被优先考虑,所以我现在不能花时间为此做足够的测试以有信心将该文档添加到 wiki .

希望这会帮助其他有时间能力的人完成我开始的工作,(或者当我有时间时它会留给后代)。

因此我们看到了核心问题:“具有必要的高级知识和适当的计算资源的人”和“有时间能力的人”的交集是空集。第一组中的任何人几乎都肯定会过度投入。

在 Windows 上,它应该像在终端中输入 python 一样容易,然后被带到商店来设置 python。

在 Windows 上设置 Python 很容易,但管理 Python 版本则不然。有一些工具可以做到这一点,例如 pyenv-win,但它们引入了另一层复杂性,对于已经被一层又一层不熟悉的东西压得喘不过气来的新手来说,这可能会让人大吃一惊。

实际上,当我说“从头开始”时,我轻描淡写了这个问题。Scratch 是 Raspberry Pi 的合理起点,您只需将操作系统映像复制到 SD 卡上,然后从那里继续,前提是您的 CNC Pi 可能尚未投入使用。在 Windows 上,这台机器可能已经投入使用,安装了数十个其他应用程序,因此将其降级为新生状态是不切实际的。因此,除了处理您必须添加的内容之外,您还必须处理其他可能已经存在的冲突内容。此外,您还有安装 C 编译器以及一些辅助工具的蠕虫病毒 – 或者处理已经安装的可能是错误版本的工具。

Docker 是某些人的答案,但它是那些“复杂性的其他层次”之一,而且是一个特别令人印象深刻的层次。如果您打算在 Windows 主机中运行 Linux,那么您就已经将“所有 Linux”引入了复杂性集。更不用说从容器内部访问主机文件系统的棘手方面了。“小问题”的数量很快就会变得非常多。许多人会在最终解决方案出现之前很久就放弃。

我最喜欢的长期解决方案是完全避免 C 编译。CNCjs 的 Javascript 部分完全独立于机器。我已经在一台机器上成功构建了 CNCjs,将所有内容复制到 Raspberry Pi Zero,然后替换了一个二进制文件以支持串口。这表明应该可以有一个包含多个二进制文件的 serialport-node 模块来支持所有常用平台——Win、Mac、Linux-x64、arm7、arm7hf。这样,就不需要运行 node-gyp 步骤了。

问题的症结在于 node-serialport 处理二进制文件的方式。将 node-serialport 更改为使用 prebuildify 相对容易(对于有时间的合适开发人员 – 但请参阅第一段)。参见串行端口/节点串行端口#975

免费注册 在 GitHub 上加入此对话。已有帐户? 登录评论
项目
状态:分流
发展

没有分支机构或拉取请求

5人参加
无法在 win10 上构建:win-x64 #638无法在 win10 上构建:win-x64 #638无法在 win10 上构建:win-x64 #638无法在 win10 上构建:win-x64 #638无法在 win10 上构建:win-x64 #638

喜欢 (0)