@@ -10,11 +10,10 @@ use std::{
1010use owo_colors:: OwoColorize ;
1111use serde:: Deserialize ;
1212use vite_install:: get_package_manager_type_and_version;
13- use vite_js_runtime:: { VersionSource , resolve_node_version} ;
1413use vite_path:: AbsolutePathBuf ;
1514use vite_workspace:: find_workspace_root;
1615
17- use crate :: { error:: Error , help} ;
16+ use crate :: { commands :: env :: config :: resolve_version , error:: Error , help} ;
1817
1918#[ derive( Debug , Deserialize ) ]
2019#[ serde( rename_all = "camelCase" ) ]
@@ -133,22 +132,22 @@ fn format_version(version: Option<String>) -> String {
133132}
134133
135134async fn get_node_version_info ( cwd : & AbsolutePathBuf ) -> Option < ( String , String ) > {
136- if let Ok ( Some ( resolution) ) = resolve_node_version ( cwd, true ) . await {
137- let source_label = match resolution. source {
138- VersionSource :: NodeVersionFile => ".node-version" ,
139- VersionSource :: EnginesNode => "engines.node" ,
140- VersionSource :: DevEnginesRuntime => "devEngines.runtime" ,
141- } ;
142- return Some ( ( resolution. version . to_string ( ) , source_label. to_string ( ) ) ) ;
135+ // Try the full managed resolution chain
136+ if let Ok ( resolution) = resolve_version ( cwd) . await {
137+ return Some ( ( resolution. version , resolution. source ) ) ;
143138 }
144139
145- // Fallback: detect system Node version
140+ // Fallback: detect system Node version (with VITE_PLUS_BYPASS to avoid hitting the shim)
146141 let version = detect_system_node_version ( ) ?;
147142 Some ( ( version, "system" . to_string ( ) ) )
148143}
149144
150145fn detect_system_node_version ( ) -> Option < String > {
151- let output = std:: process:: Command :: new ( "node" ) . arg ( "--version" ) . output ( ) . ok ( ) ?;
146+ let output = std:: process:: Command :: new ( "node" )
147+ . arg ( "--version" )
148+ . env ( vite_shared:: env_vars:: VITE_PLUS_BYPASS , "1" )
149+ . output ( )
150+ . ok ( ) ?;
152151 if !output. status . success ( ) {
153152 return None ;
154153 }
0 commit comments