0👍
Well since you have multiple question in your post I will attempt to separate it.
1. Why I need to run npm i -g @vue/cli
every time
No you don’t need to. With -g
flag it means global installation. Without -g
, it means that the dependency only exist in the project. But global flag basically allows the dependency to be access through your entire system.
2. Unable to create project
With a simple google search, users report that the issue is likely that you don’t have yarn
in your system, or some broken files, as your question lack of specification of details, please refer to the link and find a fix within the post that is most suitable for your system / case.
Side Note:
Based on the github repo of Vue Cli,
Vue CLI is now in maintenance mode. For new projects, please use create-vue to scaffold Vite-based projects. create-vue supports both Vue 2 and Vue 3.
you probably want to stick with Vite instead of Vue CLI unless you are maintaining legacy projects.