错误!在raspberry Pi 3模型上安装节点serialPort b

问题描述 投票:1回答:1

我正在做一个带有覆盆子Pi和arduino.in的IoT项目,这个案例我需要使用WebSocketSerialPort模块。因为这些模块需要与三星Artik沟通。但问题是,当我尝试安装serialPort时,它会不断出现以下错误。我寻找所有GitHub论坛的解决方案,他们没有工作。有没有人为此获得解决方案?提前致谢。请参阅错误日志以获取节点版本和其他详细信息。

pi@raspberrypi:~ $ sudo -i

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set                                                                                         a new password.

root@raspberrypi:~# sudo npm install -g --unsafe-perm serialport
(node:1740) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpd                                                                                        ir() instead.
npm ERR! Error: Method Not Allowed
npm ERR!     at errorResponse (/usr/share/npm/lib/cache/add-named.js:260:10)
npm ERR!     at /usr/share/npm/lib/cache/add-named.js:203:12
npm ERR!     at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.j                                                                                        s:167:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 4.14.50-v7+
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "--unsafe-perm" "                                                                                        serialport"
npm ERR! cwd /root
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code E405
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /root/npm-debug.log
npm ERR! not ok code 0
root@raspberrypi:~# ^C
root@raspberrypi:~#

错误的屏幕截图:

raspberry pi 3型号B板拥有最新的RASPBIAN OS。

node.js raspberry-pi raspberry-pi3 iot node-serialport
1个回答
2
投票

更新npm到最新版本为我工作:

npm install -g npm@latest

和::“npm install -g --unsafe-perm serialport”

当你遇到同样的错误时,在raspbian安装上使用node和npm版本:

npm ERR! System Linux 4.14.69-v7+
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "serialport"
npm ERR! cwd /var/www/html/plugins/rflink/resources
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code E405
© www.soinside.com 2019 - 2024. All rights reserved.