알뜰살뜰 정보/Node

(Node) npm serialport install 안될 때

쉬고싶은 거북이 2021. 2. 4. 15:42

에러로그

> @serialport/bindings@9.0.4 install /home/pi/ts-serial/node_modules/@serialport/bindings
> prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild

prebuild-install WARN install EACCES: permission denied, access '/root/.npm'
gyp WARN EACCES current user ("pi") does not have permission to access the dev dir "/root/.cache/node-gyp/12.13.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/ts-serial/node_modules/@serialport/bindings/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/pi/ts-serial/node_modules/@serialport/bindings/.node-gyp'
gyp ERR! System Linux 4.19.114-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/ts-serial/node_modules/@serialport/bindings
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN ts-serial@1.0.0 No description
npm WARN ts-serial@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @serialport/bindings@9.0.4 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @serialport/bindings@9.0.4 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! /root/.npm/_logs/2021-02-04T06_20_02_332Z-debug.log

 

해결방법

sudo npm install serialport --unsafe-perm --build-from-source