create-vue
create-vue copied to clipboard
`npm create vue@3` doesn't seem to always grab the latest version
Even using npm create vue@3 doesn't seem to always use the latest version, perhaps it needs to point to some dist-tag instead? Oh man, the behavior of npm/npx here is so confusing... and seems practically undocumented.
See: https://github.com/vuejs/create-vue/commit/f4ac339764ebd06bd23705bbaabb14fa229c31a6#commitcomment-83124443
This is essentially crappy behavior of npm. I wonder how do yarn 1/2+ & pnpm fare in this regard. But this is something we might want to extend the warning in the README.md and docs for as it really caught me off guard.
Maybe I have the same problem. When I use npm init vue@3 , the project's dependency vite is old version 2.9
But the template project's dependency vite is 3.0. How to get the latest version of template when use npm init vue@3 ? By clean the npm cache?
Isn't the vite way to do npm create vite@latest?
Source: vitejs.dev/guide
Why is npm create vue@3 considered the recommended way here? Recommended by whom? (Sincerely asking)
They are different templates with different features.
@segevfiner So this would be the same npm create vite@latest my-vue-app -- --template vue?
npm create vite is create-vite which has a vue and vue-ts templates inside it. npm create vue is create-vue, a different template, also based on Vite and it has different features, it is not based or related to create-vite AFAIK.
Thanks. And sorry. I shouldn't abduct the issue for a StackOverflow question.
I am experiencing a similar issue. Whenever I use the command npm create vue@3, I consistently receive an outdated version. However, the problem seems resolved when I utilize pnpm.
Is there a way to clear the npm cache? npm cache clean --force does not work.
npx clear-npx-cache
I dug a bit more in the npm source code, and now I realize it's never safe to rely on @3 to get the latest version.
Before https://github.com/npm/cli/pull/5244 (npm v8.16.0), there were several bugs in the npx command (which npm create calls underlyingly) about caches, so npm create vue@3 might have worked coincidentally.
After that PR, it's clear that when requesting a version range, npx would do a local-first search in the cache:
https://github.com/npm/cli/blob/c1e01d97da3b775edf104de158ee5db5cf027d0d/workspaces/libnpmexec/lib/index.js#L54-L57
I think I need to update the documentations to use npm create vue@latest everywhere.