fix(setup): auto-create .env from .env.example during backend install (#713)

* fix(setup): auto-create .env from .env.example during backend installation

- Fixes 'exit code 127' error when .env is missing
- Automatically copies .env.example to .env if it doesn't exist
- Provides clear instructions for users to configure credentials

Signed-off-by: thuggys <150315417+thuggys@users.noreply.github.com>

* Update scripts/install-backend.js

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Signed-off-by: thuggys <150315417+thuggys@users.noreply.github.com>
Co-authored-by: thuggys <150315417+thuggys@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Andy <119136210+AndyMik90@users.noreply.github.com>
Co-authored-by: Alex <63423455+AlexMadera@users.noreply.github.com>
This commit is contained in:
Crimson341
2026-01-06 07:11:50 -05:00
committed by GitHub
parent 8a4b506671
commit 84bc52264f
+23
View File
@@ -103,6 +103,29 @@ async function main() {
process.exit(1);
}
// Create .env file from .env.example if it doesn't exist
const envPath = path.join(backendDir, '.env');
const envExamplePath = path.join(backendDir, '.env.example');
if (fs.existsSync(envPath)) {
console.log('\n✓ .env file already exists');
} else if (fs.existsSync(envExamplePath)) {
console.log('\nCreating .env file from .env.example...');
try {
fs.copyFileSync(envExamplePath, envPath);
console.log('✓ Created .env file');
console.log(' Please configure it with your credentials:');
console.log(` - Run: claude setup-token`);
console.log(` - Or edit: ${envPath}`);
} catch (error) {
console.warn('Warning: Could not create .env file:', error.message);
console.warn('You will need to manually copy .env.example to .env');
}
} else {
console.warn('\nWarning: .env.example not found. Cannot auto-create .env file.');
console.warn('Please create a .env file manually if your configuration requires it.');
}
console.log('\nBackend installation complete!');
console.log(`Virtual environment: ${venvDir}`);
}