n8n-nodes-sb-render 1.1.18 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,114 +1,114 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Automatically set execute permissions on ffprobe binary after npm install
5
- * This is required for @ffprobe-installer package to work correctly
6
- */
7
-
8
- const { chmodSync, existsSync, statSync } = require('fs');
9
- const { resolve, join } = require('path');
10
- const os = require('os');
11
-
12
- // Detect current platform
13
- const platform = os.platform();
14
- const arch = os.arch();
15
-
16
- console.log(`šŸ” Platform detected: ${platform}-${arch}`);
17
-
18
- // Platform-specific binary paths
19
- const getPlatformPath = () => {
20
- const basePath = resolve(__dirname, '../node_modules/@ffprobe-installer');
21
-
22
- if (platform === 'win32') {
23
- return join(basePath, 'win32-x64/ffprobe.exe');
24
- } else if (platform === 'darwin') {
25
- if (arch === 'arm64') {
26
- return join(basePath, 'darwin-arm64/ffprobe');
27
- }
28
- return join(basePath, 'darwin-x64/ffprobe');
29
- } else if (platform === 'linux') {
30
- if (arch === 'arm64') {
31
- return join(basePath, 'linux-arm64/ffprobe');
32
- }
33
- return join(basePath, 'linux-x64/ffprobe');
34
- }
35
-
36
- return null;
37
- };
38
-
39
- // Try multiple possible paths where ffprobe might be installed
40
- const possiblePaths = [
41
- // Platform-specific path (primary)
42
- getPlatformPath(),
43
- // Fallback paths for different installations
44
- resolve(__dirname, '../node_modules/@ffprobe-installer/linux-x64/ffprobe'),
45
- resolve(__dirname, '../node_modules/@ffprobe-installer/darwin-x64/ffprobe'),
46
- resolve(__dirname, '../node_modules/@ffprobe-installer/darwin-arm64/ffprobe'),
47
- resolve(__dirname, '../node_modules/@ffprobe-installer/win32-x64/ffprobe.exe'),
48
- // Nested dependency paths
49
- resolve(__dirname, '../node_modules/@ffprobe-installer/ffprobe/node_modules/@ffprobe-installer/linux-x64/ffprobe'),
50
- ].filter(Boolean); // Remove null values
51
-
52
- let successCount = 0;
53
- let errorCount = 0;
54
-
55
- console.log('šŸ”§ Fixing ffprobe permissions...');
56
-
57
- for (const ffprobePath of possiblePaths) {
58
- if (existsSync(ffprobePath)) {
59
- try {
60
- const stats = statSync(ffprobePath);
61
- const currentMode = stats.mode;
62
-
63
- console.log(` šŸ“ Found: ${ffprobePath}`);
64
- console.log(` šŸ“Š Current mode: ${(currentMode & parseInt('777', 8)).toString(8)}`);
65
-
66
- // Set execute permissions (755 = rwxr-xr-x)
67
- if (platform !== 'win32') {
68
- chmodSync(ffprobePath, 0o755);
69
- console.log(` āœ… Set permissions to 755: ${ffprobePath}`);
70
- } else {
71
- console.log(` ā„¹ļø Windows detected, permissions already OK: ${ffprobePath}`);
72
- }
73
- successCount++;
74
- } catch (error) {
75
- console.warn(` āš ļø Could not set permissions for ${ffprobePath}:`, error.message);
76
-
77
- // Check if it's a permission error we can diagnose
78
- if (error.code === 'EACCES') {
79
- console.warn(' šŸ’” Suggestion: Try running as root/administrator or in Docker with proper permissions');
80
- } else if (error.code === 'ENOENT') {
81
- console.warn(' šŸ’” Suggestion: File may have been moved or deleted during installation');
82
- }
83
-
84
- errorCount++;
85
- }
86
- } else {
87
- console.log(` āŒ Not found: ${ffprobePath}`);
88
- }
89
- }
90
-
91
- // Summary and recommendations
92
- console.log('\nšŸ“‹ Summary:');
93
- if (successCount === 0 && errorCount === 0) {
94
- console.warn('āš ļø No ffprobe binaries found. This is normal if @ffprobe-installer is not yet installed.');
95
- console.warn('\nšŸ’” If you encounter "EACCES" or "ENOENT" errors when running SB Render:');
96
- console.warn(' 1. Ensure @ffprobe-installer is installed: npm ls @ffprobe-installer');
97
- console.warn(' 2. For Linux/Docker: chmod +x node_modules/@ffprobe-installer/*/ffprobe');
98
- console.warn(' 3. For n8n Cloud: Consider using system ffprobe instead');
99
- } else if (successCount > 0) {
100
- console.log(`āœ… Successfully processed ${successCount} ffprobe binary(ies)`);
101
-
102
- if (process.env.NODE_ENV === 'production' || process.env.N8N_CONFIG_FILES) {
103
- console.log('\n🐳 Docker/n8n environment detected. Additional tips:');
104
- console.log(' - Ensure container has execute permissions on /tmp and node_modules');
105
- console.log(' - Consider adding ffmpeg/ffprobe to your Docker image');
106
- console.log(' - For n8n Cloud: System-level ffprobe may be required');
107
- }
108
- } else {
109
- console.error('āŒ Failed to set permissions on any ffprobe binaries');
110
- console.error('\nšŸ”§ Manual fix options:');
111
- console.error(' 1. chmod +x node_modules/@ffprobe-installer/*/ffprobe');
112
- console.error(' 2. Install system ffmpeg: apt-get install ffmpeg (Linux)');
113
- console.error(' 3. Use Docker with proper --privileged or volume mounts');
114
- }
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Automatically set execute permissions on ffprobe binary after npm install
5
+ * This is required for @ffprobe-installer package to work correctly
6
+ */
7
+
8
+ const { chmodSync, existsSync, statSync } = require('fs');
9
+ const { resolve, join } = require('path');
10
+ const os = require('os');
11
+
12
+ // Detect current platform
13
+ const platform = os.platform();
14
+ const arch = os.arch();
15
+
16
+ console.log(`šŸ” Platform detected: ${platform}-${arch}`);
17
+
18
+ // Platform-specific binary paths
19
+ const getPlatformPath = () => {
20
+ const basePath = resolve(__dirname, '../node_modules/@ffprobe-installer');
21
+
22
+ if (platform === 'win32') {
23
+ return join(basePath, 'win32-x64/ffprobe.exe');
24
+ } else if (platform === 'darwin') {
25
+ if (arch === 'arm64') {
26
+ return join(basePath, 'darwin-arm64/ffprobe');
27
+ }
28
+ return join(basePath, 'darwin-x64/ffprobe');
29
+ } else if (platform === 'linux') {
30
+ if (arch === 'arm64') {
31
+ return join(basePath, 'linux-arm64/ffprobe');
32
+ }
33
+ return join(basePath, 'linux-x64/ffprobe');
34
+ }
35
+
36
+ return null;
37
+ };
38
+
39
+ // Try multiple possible paths where ffprobe might be installed
40
+ const possiblePaths = [
41
+ // Platform-specific path (primary)
42
+ getPlatformPath(),
43
+ // Fallback paths for different installations
44
+ resolve(__dirname, '../node_modules/@ffprobe-installer/linux-x64/ffprobe'),
45
+ resolve(__dirname, '../node_modules/@ffprobe-installer/darwin-x64/ffprobe'),
46
+ resolve(__dirname, '../node_modules/@ffprobe-installer/darwin-arm64/ffprobe'),
47
+ resolve(__dirname, '../node_modules/@ffprobe-installer/win32-x64/ffprobe.exe'),
48
+ // Nested dependency paths
49
+ resolve(__dirname, '../node_modules/@ffprobe-installer/ffprobe/node_modules/@ffprobe-installer/linux-x64/ffprobe'),
50
+ ].filter(Boolean); // Remove null values
51
+
52
+ let successCount = 0;
53
+ let errorCount = 0;
54
+
55
+ console.log('šŸ”§ Fixing ffprobe permissions...');
56
+
57
+ for (const ffprobePath of possiblePaths) {
58
+ if (existsSync(ffprobePath)) {
59
+ try {
60
+ const stats = statSync(ffprobePath);
61
+ const currentMode = stats.mode;
62
+
63
+ console.log(` šŸ“ Found: ${ffprobePath}`);
64
+ console.log(` šŸ“Š Current mode: ${(currentMode & parseInt('777', 8)).toString(8)}`);
65
+
66
+ // Set execute permissions (755 = rwxr-xr-x)
67
+ if (platform !== 'win32') {
68
+ chmodSync(ffprobePath, 0o755);
69
+ console.log(` āœ… Set permissions to 755: ${ffprobePath}`);
70
+ } else {
71
+ console.log(` ā„¹ļø Windows detected, permissions already OK: ${ffprobePath}`);
72
+ }
73
+ successCount++;
74
+ } catch (error) {
75
+ console.warn(` āš ļø Could not set permissions for ${ffprobePath}:`, error.message);
76
+
77
+ // Check if it's a permission error we can diagnose
78
+ if (error.code === 'EACCES') {
79
+ console.warn(' šŸ’” Suggestion: Try running as root/administrator or in Docker with proper permissions');
80
+ } else if (error.code === 'ENOENT') {
81
+ console.warn(' šŸ’” Suggestion: File may have been moved or deleted during installation');
82
+ }
83
+
84
+ errorCount++;
85
+ }
86
+ } else {
87
+ console.log(` āŒ Not found: ${ffprobePath}`);
88
+ }
89
+ }
90
+
91
+ // Summary and recommendations
92
+ console.log('\nšŸ“‹ Summary:');
93
+ if (successCount === 0 && errorCount === 0) {
94
+ console.warn('āš ļø No ffprobe binaries found. This is normal if @ffprobe-installer is not yet installed.');
95
+ console.warn('\nšŸ’” If you encounter "EACCES" or "ENOENT" errors when running SB Render:');
96
+ console.warn(' 1. Ensure @ffprobe-installer is installed: npm ls @ffprobe-installer');
97
+ console.warn(' 2. For Linux/Docker: chmod +x node_modules/@ffprobe-installer/*/ffprobe');
98
+ console.warn(' 3. For n8n Cloud: Consider using system ffprobe instead');
99
+ } else if (successCount > 0) {
100
+ console.log(`āœ… Successfully processed ${successCount} ffprobe binary(ies)`);
101
+
102
+ if (process.env.NODE_ENV === 'production' || process.env.N8N_CONFIG_FILES) {
103
+ console.log('\n🐳 Docker/n8n environment detected. Additional tips:');
104
+ console.log(' - Ensure container has execute permissions on /tmp and node_modules');
105
+ console.log(' - Consider adding ffmpeg/ffprobe to your Docker image');
106
+ console.log(' - For n8n Cloud: System-level ffprobe may be required');
107
+ }
108
+ } else {
109
+ console.error('āŒ Failed to set permissions on any ffprobe binaries');
110
+ console.error('\nšŸ”§ Manual fix options:');
111
+ console.error(' 1. chmod +x node_modules/@ffprobe-installer/*/ffprobe');
112
+ console.error(' 2. Install system ffmpeg: apt-get install ffmpeg (Linux)');
113
+ console.error(' 3. Use Docker with proper --privileged or volume mounts');
114
+ }