본문 바로가기

Error log

[Error log] code pipe line && scripts/initialize.sh 관련 deployment-log에서 만난 에러

반응형
[2021-12-07 06:37:42.942] [d-W48ETSISD][stderr]npm ERR! Linux 5.4.0-1058-aws
[2021-12-07 06:37:42.943] [d-W48ETSISD][stderr]npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
[2021-12-07 06:37:42.943] [d-W48ETSISD][stderr]npm ERR! node v8.10.0
[2021-12-07 06:37:42.943] [d-W48ETSISD][stderr]npm ERR! npm  v3.5.2
[2021-12-07 06:37:42.943] [d-W48ETSISD][stderr]npm ERR! code EMISSINGARG
[2021-12-07 06:37:42.944] [d-W48ETSISD][stderr]
[2021-12-07 06:37:42.944] [d-W48ETSISD][stderr]npm ERR! typeerror Error: Missing required argument #1
[2021-12-07 06:37:42.945] [d-W48ETSISD][stderr]npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
[2021-12-07 06:37:42.945] [d-W48ETSISD][stderr]npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
[2021-12-07 06:37:42.945] [d-W48ETSISD][stderr]npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
[2021-12-07 06:37:42.945] [d-W48ETSISD][stderr]npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
[2021-12-07 06:37:42.945] [d-W48ETSISD][stderr]npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
[2021-12-07 06:37:42.945] [d-W48ETSISD][stderr]npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
[2021-12-07 06:37:42.946] [d-W48ETSISD][stderr]npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
[2021-12-07 06:37:42.946] [d-W48ETSISD][stderr]npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
[2021-12-07 06:37:42.946] [d-W48ETSISD][stderr]npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
[2021-12-07 06:37:42.946] [d-W48ETSISD][stderr]npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
[2021-12-07 06:37:42.946] [d-W48ETSISD][stderr]npm ERR! typeerror This is an error with npm itself. Please report this error at:
[2021-12-07 06:37:42.947] [d-W48ETSISD][stderr]npm ERR! typeerror     <http://github.com/npm/npm/issues>

위와 같은 문제를 만났고 node와 npm 버전이 낮아서 발생하는 문제임을 인지하였습니다.

최신 버전으로 node를 최신버전으로 세팅했었기에 이 상황이 이해가 되지 않았습니다만

 

sudo node --version

 

위 명령어를 통해 확인한 결과 node 버전이 다르게 나오는 것을 확인할 수 있었습니다.

이를 해결하기 위해 검색하였고   

이 링크를 참고하여 which node 명령어를 실행해보니 최신 node를 설치한 곳이 deployment-log에서 말하는 위치(/usr/bin/node)와 상이한 것을  발견할 수 있었습니다.

 

root에 있는 node version을 upgrade하기 위해서는 ec2에서 어떤 명령어를 사용해야 할 지 검색하였고 

해당 링크를 발견할 수 있었으며 적용하기 시작했습니다. 

 

root@ip-172-31-41-181:/home/ubuntu# which node
/usr/local/bin/node
root@ip-172-31-41-181:/home/ubuntu# node --version
v17.2.0
root@ip-172-31-41-181:/home/ubuntu# cd ..
root@ip-172-31-41-181:/home# cd ..
root@ip-172-31-41-181:/# ls
bin  boot  dev  etc  home  initrd.img  initrd.img.old  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  snap  srv  sys  tmp  usr  var  vmlinuz  vmlinuz.old
root@ip-172-31-41-181:/# mv /usr/local/bin/node /usr/local/bin/node.bk
root@ip-172-31-41-181:/# which node
/usr/bin/node
root@ip-172-31-41-181:/# node --versiono
bash: /usr/local/bin/node: No such file or directory
root@ip-172-31-41-181:/# node --version
bash: /usr/local/bin/node: No such file or directory
root@ip-172-31-41-181:/# n bin

  Error: version required

root@ip-172-31-41-181:/# n bin 17
/usr/local/n/versions/node/17.2.0/bin/node
root@ip-172-31-41-181:/# cp /usr/local/n/versions/node/17.2.0/bin/node /usr/bin/node
cp: cannot create regular file '/usr/bin/node': Text file busy
root@ip-172-31-41-181:/# lsof /usr/bin.node
lsof: status error on /usr/bin.node: No such file or directory
lsof 4.89
 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
 latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
 latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
 usage: [-?abhKlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-E] [+|-e s] [+|-f[gG]]
 [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [+|-M] [-o [o]] [-p s]
 [+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
Use the ``-h'' option to get more help information.
root@ip-172-31-41-181:/# lsof /usr/bin/node
COMMAND     PID USER  FD   TYPE DEVICE SIZE/OFF  NODE NAME
PM2\x20v5 11795 root txt    REG  202,1 18369616 59518 /usr/bin/node
root@ip-172-31-41-181:/# kill -9 11795
root@ip-172-31-41-181:/# lsof /usr/bin/node
root@ip-172-31-41-181:/# cp /usr/local/n/versions/node/17.2.0/bin/node /usr/bin/node
root@ip-172-31-41-181:/# node -v
bash: /usr/local/bin/node: No such file or directory
root@ip-172-31-41-181:/# node --version
bash: /usr/local/bin/node: No such file or directory
root@ip-172-31-41-181:/# which node
/usr/bin/node
root@ip-172-31-41-181:/# exit
exit
ubuntu@ip-172-31-41-181:~$ sudo node --version
v17.2.0
ubuntu@ip-172-31-41-181:~$ sudo su
root@ip-172-31-41-181:/home/ubuntu# node --version
v17.2.0
root@ip-172-31-41-181:/home/ubuntu# which node
/usr/bin/node
root@ip-172-31-41-181:/home/ubuntu# exit
exit
ubuntu@ip-172-31-41-181:~$ exit
logout
Connection to ec2-3-34-46-49.ap-northeast-2.compute.amazonaws.com closed.
seonghyeonpark@seonghyeonui-MacBookPro Downloads % ssh -i "AWS_Deploy_Practice.pem" ubuntu@ec2-3-34-46-49.ap-northeast-2.compute.amazonaws.com
Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 5.4.0-1058-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Tue Dec  7 11:23:52 UTC 2021

  System load:  0.12              Processes:           100
  Usage of /:   33.5% of 7.69GB   Users logged in:     0
  Memory usage: 35%               IP address for eth0: 172.31.41.181
  Swap usage:   0%


30 updates can be applied immediately.
25 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

New release '20.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Last login: Tue Dec  7 11:12:12 2021 from 119.201.12.77
ubuntu@ip-172-31-41-181:~$ pm2 ls
┌─────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name      │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
└─────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
ubuntu@ip-172-31-41-181:~$ cd ..
ubuntu@ip-172-31-41-181:/home$ cd ..
ubuntu@ip-172-31-41-181:/$ ls
bin  boot  dev  etc  home  initrd.img  initrd.img.old  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  snap  srv  sys  tmp  usr  var  vmlinuz  vmlinuz.old
ubuntu@ip-172-31-41-181:/$ cd opt
ubuntu@ip-172-31-41-181:/opt$ ls
codedeploy-agent
ubuntu@ip-172-31-41-181:/opt$ cd codedeploy-agent/
ubuntu@ip-172-31-41-181:/opt/codedeploy-agent$ ls
Gemfile  LICENSE  bin  certs  codedeploy_agent.gemspec  deployment-root  lib  state  vendor
ubuntu@ip-172-31-41-181:/opt/codedeploy-agent$ cd deployment-root
ubuntu@ip-172-31-41-181:/opt/codedeploy-agent/deployment-root$ ls
a61eca1f-0f79-4c6c-a0bf-f70344ffd6b1  deployment-instructions  deployment-logs  ongoing-deployment
ubuntu@ip-172-31-41-181:/opt/codedeploy-agent/deployment-root$ cd deployment-logs
ubuntu@ip-172-31-41-181:/opt/codedeploy-agent/deployment-root/deployment-logs$ ls
codedeploy-agent-deployments.log
ubuntu@ip-172-31-41-181:/opt/codedeploy-agent/deployment-root/deployment-logs$ nano codedeploy-agent-deployments.log 
ubuntu@ip-172-31-41-181:/opt/codedeploy-agent/deployment-root/deployment-logs$ nano codedeploy-agent-deployments.log 
ubuntu@ip-172-31-41-181:/opt/codedeploy-agent/deployment-root/deployment-logs$

 

노드버전을 올리는데 성공하였습니다.

반응형