Skip to content

Commit d82b7fb

Browse files
committed
fix(install): add multiple fallback approaches for make compilation issues
- Force bash shell and explicit make path to avoid container environment issues - Add manual directory creation before compilation - Implement multiple fallback strategies for different build environments - Address 'make: o: No such file or directory' error in containers
1 parent 27c785a commit d82b7fb

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

scripts/install.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,43 @@ try {
8181
env: {
8282
...process.env,
8383
// Ensure make creates directories as needed
84-
MAKEFLAGS: '--no-builtin-rules'
84+
MAKEFLAGS: '--no-builtin-rules',
85+
// Force shell to be bash
86+
SHELL: '/bin/bash'
8587
}
8688
});
8789
console.log('✅ node-gyp rebuild completed successfully');
8890
} catch (gypError) {
8991
console.error('❌ node-gyp rebuild failed:', gypError.message);
9092

91-
// Try alternative approach with make directory creation
92-
console.log('🔄 Trying alternative build approach...');
93+
// Try alternative approach with explicit make path
94+
console.log('🔄 Trying alternative build approach with explicit make...');
9395
try {
94-
execSync('npx node-gyp configure && npx node-gyp build', {
96+
execSync('npx node-gyp configure && /usr/bin/make BUILDTYPE=Release -C build', {
9597
cwd: baseDir,
9698
stdio: 'inherit'
9799
});
98100
console.log('✅ Alternative build approach completed successfully');
99101
} catch (altError) {
100102
console.error('❌ Alternative build approach also failed:', altError.message);
101-
throw gypError; // Throw original error
103+
104+
// Try one more approach with manual directory creation
105+
console.log('🔄 Trying manual compilation approach...');
106+
try {
107+
// Create directories manually
108+
const objDir = path.join(baseDir, 'build/Release/obj.target/syslog_native/src/native');
109+
mkdirSync(objDir, { recursive: true });
110+
111+
// Try building again
112+
execSync('npx node-gyp build', {
113+
cwd: baseDir,
114+
stdio: 'inherit'
115+
});
116+
console.log('✅ Manual compilation approach completed successfully');
117+
} catch (manualError) {
118+
console.error('❌ Manual compilation approach also failed:', manualError.message);
119+
throw gypError; // Throw original error
120+
}
102121
}
103122
}
104123

0 commit comments

Comments
 (0)