Describe the bug
my first time trying shadcn ui and when i try to install shadcn ui on my next.js project i keep on getting this 'invalid version error', i've tried downgrading node 22 and even 20 lts via nvm, tried clearing cache and --force still no avail. thank you for your time to this matter
Affected component/components
shadcn cli
How to reproduce
1.existing nextjs project
2.ran npx shadcn@latest on existing next js project
Codesandbox/StackBlitz link
No response
Logs
0 verbose cli C:\nvm4w\nodejs\node.exe C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\bin\npm-cli.js
1 info using npm@10.8.2
2 info using node@v20.20.2
3 silly config load:file:C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\npmrc
4 silly config load:file:C:\Users\Administrator\OneDrive\Desktop\web development\next-demo\.npmrc
5 silly config load:file:C:\Users\Administrator\.npmrc
6 silly config load:file:C:\nvm4w\nodejs\etc\npmrc
7 verbose title npm exec shadcn@latest init
8 verbose argv "exec" "--" "shadcn@latest" "init"
9 verbose logfile logs-max:10 dir:C:\Users\Administrator\AppData\Local\npm-cache\_logs\2026-04-12T21_17_13_408Z-
10 verbose logfile C:\Users\Administrator\AppData\Local\npm-cache\_logs\2026-04-12T21_17_13_408Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly logfile done cleaning log files
13 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
14 http fetch GET 200 https://registry.npmjs.org/shadcn 720ms (cache revalidated)
15 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
16 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
17 silly idealTree buildDeps
18 silly fetch manifest shadcn@4.2.0
19 silly packumentCache full:https://registry.npmjs.org/shadcn cache-miss
20 http fetch GET 200 https://registry.npmjs.org/shadcn 563ms (cache revalidated)
21 silly packumentCache full:https://registry.npmjs.org/shadcn set size:926306 disposed:false
22 silly placeDep ROOT shadcn@4.2.0 REPLACE for: want: 4.2.0
23 silly fetch manifest @babel/preset-typescript@^7.27.1
24 silly packumentCache full:https://registry.npmjs.org/@babel%2fpreset-typescript cache-miss
25 silly fetch manifest @dotenvx/dotenvx@^1.48.4
26 silly packumentCache full:https://registry.npmjs.org/@dotenvx%2fdotenvx cache-miss
27 silly fetch manifest @modelcontextprotocol/sdk@^1.26.0
28 silly packumentCache full:https://registry.npmjs.org/@modelcontextprotocol%2fsdk cache-miss
29 silly fetch manifest @types/validate-npm-package-name@^4.0.2
30 silly packumentCache full:https://registry.npmjs.org/@types%2fvalidate-npm-package-name cache-miss
31 silly fetch manifest browserslist@^4.26.2
32 silly packumentCache full:https://registry.npmjs.org/browserslist cache-miss
33 silly fetch manifest commander@^14.0.0
34 silly packumentCache full:https://registry.npmjs.org/commander cache-miss
35 silly fetch manifest cosmiconfig@^9.0.0
36 silly packumentCache full:https://registry.npmjs.org/cosmiconfig cache-miss
37 http fetch GET 200 https://registry.npmjs.org/cosmiconfig 305ms (cache revalidated)
38 silly packumentCache full:https://registry.npmjs.org/cosmiconfig set size:222324 disposed:false
39 silly fetch manifest dedent@^1.6.0
40 silly packumentCache full:https://registry.npmjs.org/dedent cache-miss
41 http fetch GET 200 https://registry.npmjs.org/@modelcontextprotocol%2fsdk 550ms (cache revalidated)
42 silly packumentCache full:https://registry.npmjs.org/@modelcontextprotocol%2fsdk set size:295652 disposed:false
43 silly fetch manifest diff@^8.0.2
44 silly packumentCache full:https://registry.npmjs.org/diff cache-miss
45 http fetch GET 200 https://registry.npmjs.org/browserslist 673ms (cache revalidated)
46 silly packumentCache full:https://registry.npmjs.org/browserslist set size:504681 disposed:false
47 silly fetch manifest execa@^9.6.0
48 silly packumentCache full:https://registry.npmjs.org/execa cache-miss
49 http fetch GET 200 https://registry.npmjs.org/dedent 457ms (cache revalidated)
50 silly packumentCache full:https://registry.npmjs.org/dedent set size:77148 disposed:false
51 silly fetch manifest fast-glob@^3.3.3
52 silly packumentCache full:https://registry.npmjs.org/fast-glob cache-miss
53 http fetch GET 200 https://registry.npmjs.org/execa 102ms (cache revalidated)
54 silly packumentCache full:https://registry.npmjs.org/execa set size:181234 disposed:false
55 silly fetch manifest fs-extra@^11.3.1
56 silly packumentCache full:https://registry.npmjs.org/fs-extra cache-miss
57 http fetch GET 200 https://registry.npmjs.org/@babel%2fpreset-typescript 824ms (cache revalidated)
58 silly packumentCache full:https://registry.npmjs.org/@babel%2fpreset-typescript set size:257348 disposed:false
59 silly fetch manifest fuzzysort@^3.1.0
60 silly packumentCache full:https://registry.npmjs.org/fuzzysort cache-miss
61 http fetch GET 200 https://registry.npmjs.org/fs-extra 147ms (cache revalidated)
62 silly packumentCache full:https://registry.npmjs.org/fs-extra set size:232595 disposed:false
63 silly fetch manifest https-proxy-agent@^7.0.6
64 silly packumentCache full:https://registry.npmjs.org/https-proxy-agent cache-miss
65 http fetch GET 200 https://registry.npmjs.org/fast-glob 178ms (cache revalidated)
66 silly packumentCache full:https://registry.npmjs.org/fast-glob set size:220556 disposed:false
67 silly fetch manifest open@^11.0.0
68 silly packumentCache full:https://registry.npmjs.org/open cache-miss
69 http fetch GET 200 https://registry.npmjs.org/diff 476ms (cache revalidated)
70 silly packumentCache full:https://registry.npmjs.org/diff set size:150551 disposed:false
71 silly fetch manifest ora@^8.2.0
72 silly packumentCache full:https://registry.npmjs.org/ora cache-miss
73 http fetch GET 200 https://registry.npmjs.org/https-proxy-agent 109ms (cache revalidated)
74 silly packumentCache full:https://registry.npmjs.org/https-proxy-agent set size:81258 disposed:false
75 silly fetch manifest postcss-selector-parser@^7.1.0
76 silly packumentCache full:https://registry.npmjs.org/postcss-selector-parser cache-miss
77 http fetch GET 200 https://registry.npmjs.org/open 116ms (cache revalidated)
78 silly packumentCache full:https://registry.npmjs.org/open set size:136392 disposed:false
79 silly fetch manifest tailwind-merge@^3.0.1
80 silly packumentCache full:https://registry.npmjs.org/tailwind-merge cache-miss
81 http fetch GET 200 https://registry.npmjs.org/ora 102ms (cache revalidated)
82 silly packumentCache full:https://registry.npmjs.org/ora set size:142374 disposed:false
83 silly fetch manifest ts-morph@^26.0.0
84 silly packumentCache full:https://registry.npmjs.org/ts-morph cache-miss
85 http fetch GET 200 https://registry.npmjs.org/commander 1364ms (cache revalidated)
86 silly packumentCache full:https://registry.npmjs.org/commander set size:306325 disposed:false
87 silly fetch manifest validate-npm-package-name@^7.0.1
88 silly packumentCache full:https://registry.npmjs.org/validate-npm-package-name cache-miss
89 http fetch GET 200 https://registry.npmjs.org/tailwind-merge 425ms (cache revalidated)
90 silly packumentCache full:https://registry.npmjs.org/tailwind-merge set size:1548670 disposed:false
91 silly fetch manifest zod@^3.24.1
92 silly packumentCache full:https://registry.npmjs.org/zod cache-miss
93 http fetch GET 200 https://registry.npmjs.org/validate-npm-package-name 177ms (cache revalidated)
94 silly packumentCache full:https://registry.npmjs.org/validate-npm-package-name set size:48143 disposed:false
95 silly fetch manifest zod-to-json-schema@^3.24.6
96 silly packumentCache full:https://registry.npmjs.org/zod-to-json-schema cache-miss
97 http fetch GET 200 https://registry.npmjs.org/ts-morph 435ms (cache revalidated)
98 silly packumentCache full:https://registry.npmjs.org/ts-morph set size:540557 disposed:false
99 http fetch GET 200 https://registry.npmjs.org/@types%2fvalidate-npm-package-name 1807ms (cache revalidated)
100 silly packumentCache full:https://registry.npmjs.org/@types%2fvalidate-npm-package-name set size:17657 disposed:false
101 http fetch GET 200 https://registry.npmjs.org/@dotenvx%2fdotenvx 1816ms (cache revalidated)
102 silly packumentCache full:https://registry.npmjs.org/@dotenvx%2fdotenvx set size:670794 disposed:false
103 http fetch GET 200 https://registry.npmjs.org/zod 320ms (cache revalidated)
104 silly packumentCache full:https://registry.npmjs.org/zod set size:3489329 disposed:false
105 http fetch GET 200 https://registry.npmjs.org/fuzzysort 1121ms (cache revalidated)
106 silly packumentCache full:https://registry.npmjs.org/fuzzysort set size:83871 disposed:false
107 http fetch GET 200 https://registry.npmjs.org/postcss-selector-parser 1114ms (cache revalidated)
108 silly packumentCache full:https://registry.npmjs.org/postcss-selector-parser set size:177140 disposed:false
109 http fetch GET 200 https://registry.npmjs.org/zod-to-json-schema 1239ms (cache revalidated)
110 silly packumentCache full:https://registry.npmjs.org/zod-to-json-schema set size:309584 disposed:false
111 silly fetch manifest signal-exit@^4.1.0
112 silly packumentCache full:https://registry.npmjs.org/signal-exit cache-miss
113 http fetch GET 200 https://registry.npmjs.org/signal-exit 1069ms (cache revalidated)
114 silly packumentCache full:https://registry.npmjs.org/signal-exit set size:53489 disposed:false
115 silly placeDep node_modules/@inquirer/core signal-exit@4.1.0 REPLACE for: @inquirer/core@10.1.15 want: ^4.1.0
116 silly fetch manifest type-fest@^0.21.3
117 silly packumentCache full:https://registry.npmjs.org/type-fest cache-miss
118 http fetch GET 200 https://registry.npmjs.org/type-fest 145ms (cache revalidated)
119 silly packumentCache full:https://registry.npmjs.org/type-fest set size:557806 disposed:false
120 silly placeDep node_modules/ansi-escapes type-fest@0.21.3 REPLACE for: ansi-escapes@4.3.2 want: ^0.21.3
121 silly fetch manifest strip-ansi@^6.0.1
122 silly packumentCache full:https://registry.npmjs.org/strip-ansi cache-miss
123 http fetch GET 200 https://registry.npmjs.org/strip-ansi 102ms (cache revalidated)
124 silly packumentCache full:https://registry.npmjs.org/strip-ansi set size:44998 disposed:false
125 silly fetch manifest wrap-ansi@^7.0.0
126 silly packumentCache full:https://registry.npmjs.org/wrap-ansi cache-miss
127 http fetch GET 200 https://registry.npmjs.org/wrap-ansi 106ms (cache revalidated)
128 silly packumentCache full:https://registry.npmjs.org/wrap-ansi set size:55299 disposed:false
129 silly placeDep ROOT strip-ansi@6.0.1 OK for: cliui@8.0.1 want: ^6.0.1
130 verbose stack TypeError: Invalid Version:
130 verbose stack at new SemVer (C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\node_modules\semver\classes\semver.js:38:13)
130 verbose stack at compare (C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\node_modules\semver\functions\compare.js:3:32)
130 verbose stack at Object.gte (C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\node_modules\semver\functions\gte.js:2:30)
130 verbose stack at Node.canDedupe (C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\node_modules\@npmcli\arborist\lib\node.js:1081:32)
130 verbose stack at PlaceDep.pruneDedupable (C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:426:14)
130 verbose stack at new PlaceDep (C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:278:14)
130 verbose stack at #buildDepStep (C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:917:18)
130 verbose stack at async Arborist.buildIdealTree (C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:181:7)
130 verbose stack at async Promise.all (index 1)
130 verbose stack at async Arborist.reify (C:\Users\Administrator\AppData\Local\nvm\v20.20.2\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:131:5)
131 error Invalid Version:
132 silly unfinished npm timer reify 1776028637905
133 silly unfinished npm timer reify:loadTrees 1776028637907
134 silly unfinished npm timer idealTree:buildDeps 1776028638063
135 silly unfinished npm timer idealTree:node_modules/cliui 1776028642741
136 verbose cwd C:\Users\Administrator\OneDrive\Desktop\web development\next-demo
137 verbose os Windows_NT 10.0.26200
138 verbose node v20.20.2
139 verbose npm v10.8.2
140 verbose exit 1
141 verbose code 1
142 error A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache\_logs\2026-04-12T21_17_13_408Z-debug-0.log
System Info
dell latitude 3400 windows 11 pro
Before submitting
Describe the bug
my first time trying shadcn ui and when i try to install shadcn ui on my next.js project i keep on getting this 'invalid version error', i've tried downgrading node 22 and even 20 lts via nvm, tried clearing cache and --force still no avail. thank you for your time to this matter
Affected component/components
shadcn cli
How to reproduce
1.existing nextjs project
2.ran npx shadcn@latest on existing next js project
Codesandbox/StackBlitz link
No response
Logs
System Info
Before submitting