Skip to content

Commit

Permalink
Merge pull request #885 from onlook-dev/feat/requirement-checks-1
Browse files Browse the repository at this point in the history
Check for version managers
  • Loading branch information
Kitenite authored Dec 11, 2024
2 parents 60f6eb0 + ec02e6c commit b64255b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion apps/studio/electron/main/requirements/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,22 @@ function checkGitInstallation(): boolean {

function checkNodeInstallation(): boolean {
try {
execSync('npm --version', { stdio: 'ignore' });
const versionManagerPaths = [
`${process.env.HOME}/.nvm/versions/node`, // Nvm
`${process.env.HOME}/.fnm/node-versions`, // Fnm
`${process.env.N_PREFIX}/bin`, // N
'/usr/local/n/versions/node', // N
`${process.env.VOLTA_HOME}/bin`, // Volta
`${process.env.HOME}/.volta/bin`, // Volta
`${process.env.HOME}/.asdf/installs/nodejs`, // ASDF
]
.filter(Boolean);

const existingPath = process.env.PATH || '';
const pathSeparator = process.platform === 'win32' ? ';' : ':';
const enhancedPath = [...versionManagerPaths, existingPath].join(pathSeparator);

execSync('npm --version', { stdio: 'ignore', env: { ...process.env, PATH: enhancedPath } });
return true;
} catch (error) {
console.error('Npm check failed:', error);
Expand Down

0 comments on commit b64255b

Please sign in to comment.