2024-04-02 16:32:44 +02:00
|
|
|
Index: node-v21.7.1/tools/install.py
|
2023-11-07 10:48:41 +01:00
|
|
|
===================================================================
|
2024-04-02 16:32:44 +02:00
|
|
|
--- node-v21.7.1.orig/tools/install.py
|
|
|
|
+++ node-v21.7.1/tools/install.py
|
|
|
|
@@ -6,6 +6,7 @@ import errno
|
2023-11-07 10:48:41 +01:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import sys
|
|
|
|
+from distutils import sysconfig
|
|
|
|
import re
|
|
|
|
|
2024-04-02 16:32:44 +02:00
|
|
|
def abspath(*args):
|
|
|
|
@@ -66,6 +67,10 @@ def try_copy(options, path, dest):
|
2023-11-07 10:48:41 +01:00
|
|
|
try_unlink(target_path) # prevent ETXTBSY errors
|
|
|
|
return shutil.copy2(source_path, target_path)
|
|
|
|
|
|
|
|
+def libdir():
|
|
|
|
+ libdir_fq = sysconfig.get_config_var("LIBDIR")
|
|
|
|
+ return re.sub("^" + re.escape(node_prefix + "/"), "", libdir_fq)
|
|
|
|
+
|
2024-04-02 16:32:44 +02:00
|
|
|
def try_remove(options, path, dest):
|
|
|
|
source_path, target_path = mkpaths(options, path, dest)
|
|
|
|
if not options.silent:
|
|
|
|
@@ -82,7 +87,7 @@ def uninstall(options, paths, dest):
|
|
|
|
try_remove(options, path, dest)
|
2023-11-07 10:48:41 +01:00
|
|
|
|
2024-04-02 16:32:44 +02:00
|
|
|
def package_files(options, action, name, bins):
|
|
|
|
- target_path = os.path.join('lib/node_modules', name)
|
|
|
|
+ target_path = os.path.join(libdir(), 'node_modules', name)
|
2023-11-07 10:48:41 +01:00
|
|
|
|
|
|
|
# don't install npm if the target path is a symlink, it probably means
|
|
|
|
# that a dev version of npm is installed there
|
2024-04-02 16:32:44 +02:00
|
|
|
@@ -103,7 +108,7 @@ def package_files(options, action, name,
|
2023-11-07 10:48:41 +01:00
|
|
|
if action == uninstall:
|
2024-04-02 16:32:44 +02:00
|
|
|
action(options, [link_path], os.path.join('bin', bin_name))
|
2023-11-07 10:48:41 +01:00
|
|
|
elif action == install:
|
2024-04-02 16:32:44 +02:00
|
|
|
- try_symlink(options, os.path.join('../lib/node_modules', name, bin_target), link_path)
|
|
|
|
+ try_symlink(options, os.path.join('..', libdir(), 'node_modules', name, bin_target), link_path)
|
2023-11-07 10:48:41 +01:00
|
|
|
else:
|
|
|
|
assert 0 # unhandled action type
|
|
|
|
|
2024-04-02 16:32:44 +02:00
|
|
|
Index: node-v21.7.1/lib/internal/modules/cjs/loader.js
|
2023-11-07 10:48:41 +01:00
|
|
|
===================================================================
|
2024-04-02 16:32:44 +02:00
|
|
|
--- node-v21.7.1.orig/lib/internal/modules/cjs/loader.js
|
|
|
|
+++ node-v21.7.1/lib/internal/modules/cjs/loader.js
|
|
|
|
@@ -1528,7 +1528,7 @@ Module._initPaths = function() {
|
2023-11-07 10:48:41 +01:00
|
|
|
path.resolve(process.execPath, '..') :
|
|
|
|
path.resolve(process.execPath, '..', '..');
|
|
|
|
|
|
|
|
- const paths = [path.resolve(prefixDir, 'lib', 'node')];
|
|
|
|
+ const paths = ['/usr/lib/node'];
|
|
|
|
|
|
|
|
if (homeDir) {
|
|
|
|
ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries'));
|