开源改变世界

树莓派 #19

推推 grbl 3年前 (2023-02-02) 200次浏览
关闭
Protoneer 打开了这个问题 2016 年 1 月 1 日 · 19条评论
关闭

树莓派#19

Protoneer 打开了这个问题 2016 年 1 月 1 日 · 19条评论

注释

树莓派 #19

你好。这可以在 Raspberry Pi B+ 上运行吗?

我用 NPM 安装了它,但它失败了……

树莓派 #19

Protoneer,我让它在 RPi B+ 和 RPi 2 上运行,两者都带有 Wheezy 和 Jessie。起初我对包裹有些奇怪,但不记得细节了。

您看到的错误是什么?

树莓派 #19
作者

我尝试从 npm 安装它,但串行库存在问题。

将尝试为您获取日志……
在 2016 年 1 月 1 日下午 12:18,“meikrantz” notifications@github.com写道:

Protoneer,我让它在 RPi B+ 和 RPi 2 上运行,两者都带有 Wheezy 和
Jessie。起初我对包裹有些奇怪,但不记得
细节了。

您看到的错误是什么?


直接回复此电子邮件或在 GitHub
#19(评论)上查看。

树莓派 #19
合作者

您运行的是哪个版本的 Node.js?如果您运行的是 Node v4 或 v5,则需要使用 gcc/g++ v4.8 或更高版本才能正确编译 serialport 模块。

树莓派 #19

在我的一个系统上的 cnc.js 版本升级期间,我不得不在某一时刻直接安装 serialport。在两个不同的 Pi 上一切正常,一个运行节点 v0.12.1,一个运行节点 v5.2.0。

在node v5.2.0版本上,我无法升级到cnc.js v0.14,直到我卸载了以前的版本,然后它才能正常工作。

树莓派 #19
作者

你好@cheton,@meikrantz. 让我们重新开始。我想为 Raspberries 创建一个 img 文件,以配合我的 RPI CNC 板。目前我有 bCNC 正在工作,但我想添加 CNC.js 作为替代方案。(我创建的脚本在创建图像之前设置 RPI 环境:https ://github.com/Protoneer/RPI-CNC-Config -脚本/树/主/脚本

查看 Wiki,不清楚我需要 CNC.js 的 NodeJS 版本。RPI Jesse 目前附带 0.10.29…哪个版本最适合目标?

树莓派 #19
作者

下面是我的安装日志…

我设法从 Adafruits 教程将 Node 升级到 0.12.6。
https://learn.adafruit.com/node-embedded-development/installing-node-dot-js

然后执行“sudo npm install -g cncjs”并出现以下错误。(运行时间很长)

我错过了一步吗?

pi@raspberrypi:~ $ sudo npm install -g cncjs
npm WARN peerDependencies The peer dependency history@^1.17.0 included from react-router will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN engine hawk@0.10.2: wanted: {"node":"0.8.x"} (current: {"node":"0.12.6","npm":"2.11.2"})

> react-router@1.0.3 postinstall /usr/local/lib/node_modules/cncjs/node_modules/react-router
> node ./npm-scripts/postinstall.js

\
> bufferutil@1.2.1 install /usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

 user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil/.node-gyp"
make: Entering directory '/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  COPY Release/bufferutil.node
make: Leaving directory '/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil/build'
npm WARN deprecated i18next-client@1.10.3: you can use npm install i18next from version 2.0.0
npm WARN engine hoek@0.7.6: wanted: {"node":"0.8.x"} (current: {"node":"0.12.6","npm":"2.11.2"})
npm WARN engine boom@0.3.8: wanted: {"node":"0.8.x"} (current: {"node":"0.12.6","npm":"2.11.2"})
npm WARN engine cryptiles@0.1.3: wanted: {"node":"0.8.x"} (current: {"node":"0.12.6","npm":"2.11.2"})
npm WARN engine sntp@0.1.4: wanted: {"node":"0.8.x"} (current: {"node":"0.12.6","npm":"2.11.2"})

> utf-8-validate@1.2.1 install /usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate/.node-gyp"
make: Entering directory '/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  COPY Release/validation.node
make: Leaving directory '/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate/build'
-
> utf-8-validate@1.2.1 install /usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate/.node-gyp"
make: Entering directory '/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  COPY Release/validation.node
make: Leaving directory '/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate/build'
|
> bufferutil@1.2.1 install /usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil/.node-gyp"
make: Entering directory '/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  COPY Release/bufferutil.node
make: Leaving directory '/usr/local/lib/node_modules/cncjs/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil/build'

> serialport@2.0.5 install /usr/local/lib/node_modules/cncjs/node_modules/serialport
> node-pre-gyp install --fallback-to-build

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/cncjs/node_modules/serialport/.node-gyp"
make: Entering directory '/usr/local/lib/node_modules/cncjs/node_modules/serialport/build'
make: *** No rule to make target '../.node-gyp/0.12.6/common.gypi', needed by 'Makefile'.  Stop.
make: Leaving directory '/usr/local/lib/node_modules/cncjs/node_modules/serialport/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 4.1.13+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/local/lib/node_modules/cncjs/node_modules/serialport/build/Release/node-v14-linux-arm/serialport.node" "--module_name=serialport" "--module_path=/usr/local/lib/node_modules/cncjs/node_modules/serialport/build/Release/node-v14-linux-arm"
gyp ERR! cwd /usr/local/lib/node_modules/cncjs/node_modules/serialport
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/cncjs/node_modules/serialport/build/Release/node-v14-linux-arm/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/cncjs/node_modules/serialport/build/Release/node-v14-linux-arm' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cncjs/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:1015:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
node-pre-gyp ERR! System Linux 4.1.13+
node-pre-gyp ERR! command "node" "/usr/local/lib/node_modules/cncjs/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/cncjs/node_modules/serialport
node-pre-gyp ERR! node -v v0.12.6
node-pre-gyp ERR! node-pre-gyp -v v0.6.13
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/cncjs/node_modules/serialport/build/Release/node-v14-linux-arm/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/cncjs/node_modules/serialport/build/Release/node-v14-linux-arm' (1)
npm ERR! Linux 4.1.13+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cncjs"
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE

npm ERR! serialport@2.0.5 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@2.0.5 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/npm-debug.log

树莓派 #19
合作者

嗨 Protoner,

您可以尝试添加prefix=~/.npm到您的~/.npmrc. 例如:

[cheton@piduino:~]
$ echo "prefix=~/.npm" >> ~/.npmrc

[cheton@piduino:~]
$ cat ~/.npmrc 
prefix=~/.npm

之后,您可以在cncjs不使用的情况下进行安装sudo

[cheton@piduino:~]
$ npm install -g cncjs

这应该可以解决您在 Raspberry Pi 上的安装问题。

树莓派 #19
合作者

我更新了 README.md 中的安装指南。
https://github.com/cheton/cnc.js#installation

树莓派 #19
作者

@cheton,现在我们正在用煤气做饭!!!

您的建议解决了错误。我现在面临的唯一问题是运行“cnc”返回“未找到命令”… :) 我也重新启动了 RPI。

知道那可能是什么吗?

树莓派 #19
合作者

它可能安装在~/.npm/node_modules/目录中。如果是这样,请附加~/.npm/bin~/.bash_profile或中的 PATH 环境~/.bashrc,如下所示:

export PATH=$PATH:~/.npm/bin/
树莓派 #19
作者

谢谢@cheton. 我设法让它继续下去。出于某种原因,我不能去“cnc”,我必须去
“./cnc”或“node cnc”。

否则我已经连接到 GRBL 并四处移动了东西。

树莓派 #19
合作者

好的。如果您有其他问题或遇到任何问题,请随时告诉我。

树莓派 #19
作者

谢谢@cheton… 我很惊讶我现在只看到了 CNC.JS。它看起来非常精致且经过深思熟虑。做得好!!!