@@ -75,7 +75,7 @@ export class Dependencies {
7575 let canProceedWithDependencyCheck = false ;
7676 if ( ! isValidNode ) {
7777 progress . report ( { message : 'Node.js version not supported. Checking options...' } ) ;
78- canProceedWithDependencyCheck = await Dependencies . HandleNotValidNodeVersion ( spfxVersion . SupportedNodeVersions [ spfxVersion . SupportedNodeVersions . length - 1 ] , spfxVersion . SupportedNodeVersions ) ;
78+ canProceedWithDependencyCheck = await Dependencies . HandleNotValidNodeVersion ( spfxVersion . SupportedNodeVersions [ spfxVersion . SupportedNodeVersions . length - 1 ] , spfxVersion . SupportedNodeVersions , spfxVersion . Version ) ;
7979 }
8080
8181 if ( isValidNode || canProceedWithDependencyCheck ) {
@@ -119,7 +119,7 @@ export class Dependencies {
119119 */
120120 public static isValidNodeJs ( SupportedNodeVersions : string [ ] , NodeVersion : string | null = null ) : boolean {
121121 try {
122- const output = NodeVersion ? `v${ NodeVersion } ` : execSync ( 'node --version' , { shell : TerminalCommandExecuter . shell } ) ;
122+ const output = NodeVersion ? `v${ NodeVersion } ` : execSync ( 'node --version' ) ;
123123 const match = / v (?< major_version > \d + ) \. (?< minor_version > \d + ) \. (?< patch_version > \d + ) / gm. exec ( output . toString ( ) ) ;
124124
125125 Logger . info ( `Node.js version: ${ output } ` ) ;
@@ -157,7 +157,7 @@ export class Dependencies {
157157 * @param supportedNodeVersions - An array of strings representing the supported Node.js versions for SPFx development
158158 * @returns A boolean indicating whether the invalid Node.js version was successfully handled
159159 */
160- private static HandleNotValidNodeVersion ( requiredNodeVersions : string , supportedNodeVersions : string [ ] ) : boolean {
160+ private static HandleNotValidNodeVersion ( requiredNodeVersions : string , supportedNodeVersions : string [ ] , spfxVersion : string ) : boolean {
161161 const nodeVersionManager = getExtensionSettings < string > ( 'nodeVersionManager' , 'none' ) ;
162162 const isWindows = os . platform ( ) === 'win32' ;
163163
@@ -167,7 +167,7 @@ export class Dependencies {
167167 const useNvsOption = 'Use NVS' ;
168168
169169 Notifications . warning (
170- `Your Node.js version is not supported for SPFx v ${ requiredNodeVersions } .
170+ `Node.js v ${ requiredNodeVersions } is not supported for SPFx ${ spfxVersion } .
171171 It is recommended to use a Node Version Manager to handle multiple Node.js versions
172172 and set SPFx Toolkit setting with your preferred Node Version Manager.
173173 Please select one of the options below to get help on installing or updating your Node.js version.` ,
@@ -193,7 +193,7 @@ export class Dependencies {
193193 const requiredNodeVersionToInstall = requiredNodeVersions . replace ( / x / g, '0' ) ;
194194 if ( nodeVersionManager === NodeVersionManagers . nvm ) {
195195 const nvmListCommand = isWindows ? 'list' : 'ls --no-alias' ;
196- const nodeVersions = execSync ( `nvm ${ nvmListCommand } ` , { shell : TerminalCommandExecuter . shell } ) ;
196+ const nodeVersions = execSync ( `nvm ${ nvmListCommand } ` ) ;
197197 const versions = isWindows ?
198198 nodeVersions . toString ( ) . split ( '\n' ) . map ( v => v . trim ( ) . replace ( / ^ \* ? \s * / , '' ) . replace ( / \s * \( .* \) $ / , '' ) . trim ( ) ) . filter ( v => v && / ^ \d + \. \d + \. \d + $ / . test ( v ) )
199199 : nodeVersions . toString ( ) . split ( '\n' ) . map ( v => v . trim ( ) . replace ( / ^ ( \* | - > ) ? \s * / , '' ) . replace ( / \s * \( .* \) $ / , '' ) . replace ( / ^ v / , '' ) . trim ( ) ) . filter ( v => v && / ^ \d + \. \d + \. \d + $ / . test ( v ) ) ;
@@ -203,7 +203,7 @@ export class Dependencies {
203203 const nvmInstallAndUseCommand = `nvm install ${ requiredNodeVersionToInstall } && nvm use ${ requiredNodeVersionToInstall } ` ;
204204 useNodeVersionOption = firstNodeValidVersion ? nvmUseCommand : nvmInstallAndUseCommand ;
205205 } else {
206- const nodeVersions = execSync ( 'nvs list' , { shell : TerminalCommandExecuter . shell } ) ;
206+ const nodeVersions = execSync ( 'nvs list' ) ;
207207 const versions = nodeVersions . toString ( ) . split ( '\n' ) . map ( v => {
208208 const match = / n o d e \/ ( \d + \. \d + \. \d + ) / . exec ( v . trim ( ) ) ;
209209 return match ? match [ 1 ] : '' ;
0 commit comments