[에러대백과] yarn 으로 create-react-app 설치 중 에러 (n 명령어로 node 버전 수정)

2023. 2. 26. 21:01WEB Dev/에러대백과

728x90

 

yarn 으로 설치를 하다 아래와 같은 에러가 발생했다.

 

 

번역하면 노드가 모듈과 호환되지 않는 버전으로 버전을 변경하라는 이야기..

그 정도로 오래전 노드를 쓰고 있었나....!!

요즘 계속 노드 호환성이 불량하다는 에러 메시지가 나오고 있다 흑흑..

 

 

 

1. 버전 변경을 위해 npm 으로 n 을 설치해준다. 

 

 

 

 

 

2. node 최신 버전을 설치한다. lts로 설치하기 위해 n lts을 입력한다. 바로 lts 최신 버전의 node 가 설치된다.

버전이 필요한 경우 n 16.15.1 처럼 입력한다.

만약 node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node) 과 같은 오류가 발생한다면 버전을 낮추는 방법도 있다.

 

 

 

 

 

3. 이전 버전을 삭제한다. n prune

 

 

 

 

 

 

yarn add v1.22.17
info No lockfile found.
[1/4] Resolving packages...
warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
warning react-scripts > workbox-webpack-plugin > workbox-build > rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning react-scripts > css-minimizer-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning react-scripts > workbox-webpack-plugin > workbox-build > @rollup/plugin-replace > magic-string > sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
[2/4] Fetching packages...
error eslint@8.35.0: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "14.15.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template -has failed.

Deleting generated file... package.json
Deleting react-complete-orderapp-2/ from 
Done.
error Command failed.
Exit code: 1
Command: /usr/local/bin/create-react-app
Arguments: react-complete-orderapp-2
Directory: /
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

728x90