开源改变世界

Raspbian Jessy:串行连接错误 #59

推推 grbl 3年前 (2023-02-02) 220次浏览
关闭
thymjan 打开了这个问题 2016 年 8 月 2 日 · 2 条评论
关闭

Raspbian Jessy:串行连接错误#59

thymjan 打开了这个问题 2016 年 8 月 2 日 · 2 条评论

注释

Raspbian Jessy:串行连接错误 #59

我已经尝试安装 cncjs 两次(按照指示)。服务器应用程序正在启动。
在客户端上调用服务器地址时,前端会出现。
但是在启动串行连接时每次都会出现错误,然后什么也没有发生:

2016-08-01T18:10:49.956Z - error: uncaughtException: Symbol is not defined date=Mon Aug 01 2016 20:10:49 GMT+0200 (CEST), pid=19238, uid=1000, gid=1000, cwd=/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app, execPath=/usr/bin/nodejs, version=v0.10.29, argv=[node, /home/pi/.npm/bin/cnc], rss=51122176, heapTotal=43238372, heapUsed=25742296, loadavg=[0.6337890625, 0.79150390625, 0.7919921875], uptime=243399.775887884, trace=[column=47, file=/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js, function=GrblLineParser.parse, line=1813, method=parse, native=false, column=39, file=/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js, function=Grbl.parse, line=2326, method=parse, native=false, column=34, file=/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js, function=, line=2752, method=null, native=false, column=17, file=events.js, function=SerialPort.emit, line=95, method=emit, native=false, column=17, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/parsers.js, function=null, line=24, method=null, native=false, column=null, file=null, function=Array.forEach, line=null, method=forEach, native=true, column=13, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/parsers.js, function=, line=23, method=null, native=false, column=18, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js, function=SerialPort._emitData, line=310, method=_emitData, native=false, column=14, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js, function=, line=290, method=null, native=false, column=7, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js, function=, line=303, method=null, native=false, column=17, file=fs.js, function=Object.wrapper [as oncomplete], line=463, method=wrapper [as oncomplete], native=false], stack=[ReferenceError: Symbol is not defined, at GrblLineParser.parse (/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js:1813:47), at Grbl.parse (/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js:2326:39), at SerialPort.<anonymous> (/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js:2752:34), at SerialPort.emit (events.js:95:17), at /home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/parsers.js:24:17, at Array.forEach (native), at SerialPort.<anonymous> (/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/parsers.js:23:13), at SerialPort._emitData (/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js:310:18), at SerialPort.<anonymous> (/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js:290:14), at SerialPort.<anonymous> (/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js:303:7), at Object.wrapper [as oncomplete] (fs.js:463:17)] 2016-08-01T18:10:50.029Z - error: uncaughtException: Symbol is not defined date=Mon Aug 01 2016 20:10:50 GMT+0200 (CEST), pid=19238, uid=1000, gid=1000, cwd=/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app, execPath=/usr/bin/nodejs, version=v0.10.29, argv=[node, /home/pi/.npm/bin/cnc], rss=51216384, heapTotal=43238372, heapUsed=26069596, loadavg=[0.6337890625, 0.79150390625, 0.7919921875], uptime=243399.931657921, trace=[column=47, file=/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js, function=GrblLineParser.parse, line=1813, method=parse, native=false, column=39, file=/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js, function=Grbl.parse, line=2326, method=parse, native=false, column=34, file=/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js, function=, line=2752, method=null, native=false, column=17, file=events.js, function=SerialPort.emit, line=95, method=emit, native=false, column=17, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/parsers.js, function=null, line=24, method=null, native=false, column=null, file=null, function=Array.forEach, line=null, method=forEach, native=true, column=13, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/parsers.js, function=, line=23, method=null, native=false, column=18, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js, function=SerialPort._emitData, line=310, method=_emitData, native=false, column=14, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js, function=, line=290, method=null, native=false, column=7, file=/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js, function=, line=303, method=null, native=false, column=17, file=fs.js, function=Object.wrapper [as oncomplete], line=463, method=wrapper [as oncomplete], native=false], stack=[ReferenceError: Symbol is not defined, at GrblLineParser.parse (/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js:1813:47), at Grbl.parse (/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js:2326:39), at SerialPort.<anonymous> (/home/pi/.npm/lib/node_modules/cncjs/dist/cnc/app/index.js:2752:34), at SerialPort.emit (events.js:95:17), at /home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/parsers.js:24:17, at Array.forEach (native), at SerialPort.<anonymous> (/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/parsers.js:23:13), at SerialPort._emitData (/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js:310:18), at SerialPort.<anonymous> (/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js:290:14), at SerialPort.<anonymous> (/home/pi/.npm/lib/node_modules/cncjs/node_modules/serialport/lib/serialport.js:303:7), at Object.wrapper [as oncomplete] (fs.js:463:17)]

我是 node.js 的新手。这个消息对我来说有点太大了。但是串口出了问题,是吗?

这是我的安装程序:
cnc_installation_procedure.txt

你能告诉我哪里出了问题吗?

Raspbian Jessy:串行连接错误 #59
合作者

你好@thymjan,

根据您的安装日志,您的 Raspbian Jessey 中运行着两个 Node.js:Node.js v4.4.7(由 nvm 安装)和 Node.js v0.10(系统默认)。

我在你的日志中发现了这个错误:

nvm is not compatible with the npm config "prefix" option: currently set to "/home/pi/.npm"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.4.7` to unset it.

您更新的 npm 运行的是 Node.js v0.10,而不是 Node.js v4.4.7。要解决此问题,您可以删除该~/.npmrc文件或只运行npm config delete prefix以删除前缀设置。还请记住将以下行添加到~/.bashrc~/.bash_profilenvm登录时自动获取:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

然后,确保您正在使用以下命令运行 Node.js v4:

$ source ~/.bashrc
$ node -v
v4.4.7

之后,您可以运行以下步骤来安装 cncjs:

$ npm install npm@latest -g
$ npm -v
3.10.5
$ npm install -g cncjs
Raspbian Jessy:串行连接错误 #59
作者

亲爱的@cheton,

感谢您的快速回答和详细明确的说明!我一步步跟着他们。
“node -v”仍然是“v0.10.29”,所以我再次尝试“nvm install 4”。答案是:
v4.4.7 已经安装。
现在使用 node v4.4.7 (npm v2.15.8)
创建默认别名:default -> 4 (-> v4.4.7)

然后……成功了!cnc 的安装没有问题,串行连接也没有问题。

非常感谢你!这是一个很好用的前端。