포스트

npm install forever -g 에러, vulnerabilities

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
root@abc:~/server/api# sudo npm install forever -g
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'triple-beam@1.4.1',
npm WARN EBADENGINE   required: { node: '>= 14.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies

changed 295 packages, and audited 296 packages in 10s

43 packages are looking for funding
  run `npm fund` for details

8 vulnerabilities (4 high, 4 critical)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Error 로그를 보니 node.js의 버전이 맞지 않는다고 하므로, 버전을 업그레이드해주면 됨.

그 전에 apt 최신으로 업데이트

1
sudo apt update

노드의 버전을 확인 node -v

1
2
root@abc:~/server/api# node -v
v12.22.9

nodejs의 캐쉬를 삭제해주고 nodejs의 버전을 관리해주는 n 모듈을 설치

1
2
npm cache clean -f
npm install -g n

원하는 node.js 버전을 입력

n stable: 안정적인 버전 n latest: 최신 버전 n lts: LTS 버전 n x.x.x: 특정 x.x.x버전

n stable을 입력.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
root@abc:~/server/api# n stable
  installing : node-v18.17.0
       mkdir : /usr/local/n/versions/node/18.17.0
       fetch : https://nodejs.org/dist/v18.17.0/node-v18.17.0-linux-x64.tar.xz
     copying : node/18.17.0
   installed : v18.17.0 (with npm 9.6.7)

Note: the node command changed location and the old location may be remembered in your current shell.
         old : /usr/bin/node
         new : /usr/local/bin/node
If "node --version" shows the old version then start a new shell, or reset the location hash with:
hash -r  (for bash, zsh, ash, dash, and ksh)
rehash   (for csh and tcsh)

1
hash -r
1
2
3
root@abc:~/server/api# node -v
v18.17.0

버전 업그레이드 확인됨.

다시 forever 설치

1
sudo npm install forever -g

더 이상 vulnerabilities 에러는 나오지 않음.

참고출처) https://jsikim1.tistory.com/158

이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.