File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -961,7 +961,8 @@ export function ensureNpmWrappersForBrowserToolkit(
961961 const eigentBinDir = path . join ( os . homedir ( ) , '.eigent' , 'bin' ) ;
962962 fs . mkdirSync ( eigentBinDir , { recursive : true } ) ;
963963
964- const wrapperVersion = '1' ;
964+ // Store wrapper target so wrappers are recreated when venv path changes (e.g. app upgrade)
965+ const wrapperVersion = `wrapper:${ pythonPath } ` ;
965966 const versionFile = path . join ( eigentBinDir , '.npm_wrapper_version' ) ;
966967 const storedVersion = fs . existsSync ( versionFile )
967968 ? fs . readFileSync ( versionFile , 'utf-8' ) . trim ( )
@@ -976,10 +977,14 @@ export function ensureNpmWrappersForBrowserToolkit(
976977 process . platform === 'win32' ? 'npx.cmd' : 'npx'
977978 ) ;
978979
980+ // Recreate wrappers when: version changed, wrappers missing, or existing shebang points to wrong Python
979981 const needsUpdate =
980982 storedVersion !== wrapperVersion ||
981983 ! fs . existsSync ( npmWrapper ) ||
982- ! fs . existsSync ( npxWrapper ) ;
984+ ! fs . existsSync ( npxWrapper ) ||
985+ ( process . platform !== 'win32' &&
986+ fs . existsSync ( npmWrapper ) &&
987+ ! fs . readFileSync ( npmWrapper , 'utf-8' ) . startsWith ( `#!${ pythonPath } ` ) ) ;
983988
984989 if ( needsUpdate ) {
985990 try {
You can’t perform that action at this time.
0 commit comments