본문 바로가기
IT&DEV - IT & 개발/Frontend

vue 프로젝트 생성시 command failed: yarn 발생 해결방법

by Hoft 2022. 4. 22.

 

vue create [프로젝트명] 으로 프로젝트 생성시 yarn 을 못찾는 경우가 있는데

 

보통은 커맨드 라인에 yarn 명령어로 실행하여 yarn이 잘 설치되어 있는지 확인해 봐야 합니다.

 

yarn 명령어를 입력하였을 때 command failed: yarn 으로 나온다면

yarn 이 설치가 안되어있어 다시 설치하거나 글로벌로 설치하여 해결이 가능합니다.

 

brew install yarn
또는
npm install -g yarn
 

 

설치가 잘 되어있고 yarn 명령어도 실행되지만 vue create [프로젝트명] 으로 했을 때

그래도 command failed: yarn 이 나온다면

node 버전을 업그레이드 하여 해결이 가능합니다.

 

▼ command failed: yarn 발행 화면

yarn install v1.22.18
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error @achrinza/node-ipc@9.2.2: The engine "node" is incompatible with this module. Expected version "8 || 10 || 12 || 14 || 16 || 17". Got "15.12.0"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error Found incompatible module.
 ERROR  Error: command failed: yarn
Error: command failed: yarn
    at ChildProcess.<anonymous> (/opt/homebrew/lib/node_modules/@vue/cli/lib/util/executeCommand.js:138:16)
    at ChildProcess.emit (node:events:369:20)
    at maybeClose (node:internal/child_process:1067:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
 

▼ node 버전 업그레이드

brew upgrade node

==> Upgrading 1 outdated package:
node 15.12.0 -> 17.9.0
 

▼ 정상 작동 확인

vue create moamoa

Vue CLI v5.0.4
? Target directory /Users/gamto/IdeaProjects/moamoa already exists. Pick an action: Overwrite

Removing /Users/gamto/IdeaProjects/moamoa...


Vue CLI v5.0.4
? Please pick a preset: moapreset ([Vue 3] babel, router, eslint)


Vue CLI v5.0.4
✨  Creating project in /Users/gamto/IdeaProjects/moamoa.
🗃  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...

yarn install v1.22.18
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...

success Saved lockfile.
✨  Done in 6.79s.
🚀  Invoking generators...
📦  Installing additional dependencies...

yarn install v1.22.18
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...

success Saved lockfile.
✨  Done in 7.36s.
⚓  Running completion hooks...

📄  Generating README.md...

🎉  Successfully created project moamoa.
👉  Get started with the following commands:

 $ cd moamoa
 $ yarn serve
 

 

#vue #yarn #frontend #mobile

 

 

댓글