Reputation: 45
I am doing an IoT project with raspberry Pi and arduino.in
this case I need to work with both WebSocket
and SerialPort
modules. because those modules are required to communicate with Samsung Artik. but the problem is when I am trying to install serialPort
it is getting following error continuously. I looked for all the GitHub forums for the solutions and they were not working. Does anyone get a solution for this? Thanks in advance. refer the error log for node versions and other details.
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:~#
Screenshot of error:
raspberry pi 3 model B board has latest RASPBIAN OS.
Upvotes: 2
Views: 2192
Reputation: 36
Update npm to the latest release worked for me :
npm install -g npm@latest
and :: "npm install -g --unsafe-perm serialport"
used node and npm version on a raspbian installation when a got the same error you described :
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
Upvotes: 2