File nodejs-libpath.patch of Package nodejs.openSUSE_Leap_42.1_Update
Index: node-v4.7.3/lib/module.js
===================================================================
--- node-v4.7.3.orig/lib/module.js
+++ node-v4.7.3/lib/module.js
@@ -453,7 +453,12 @@ Module._initPaths = function() {
homeDir = process.env.HOME;
}
- var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
+ var paths = ['/usr/lib/node'];
+ try {
+ if (fs.statSync('/usr/lib64').isDirectory()) {
+ paths.push('/usr/lib64/node');
+ }
+ } catch (e) {}
if (homeDir) {
paths.unshift(path.resolve(homeDir, '.node_libraries'));
Index: node-v4.7.3/tools/install.py
===================================================================
--- node-v4.7.3.orig/tools/install.py
+++ node-v4.7.3/tools/install.py
@@ -81,7 +81,10 @@ def update_shebang(path, shebang):
open(path, 'w').write(s)
def npm_files(action):
- target_path = 'lib/node_modules/npm/'
+ if os.path.isdir('/usr/lib64'):
+ target_path = 'lib64/node_modules/npm/'
+ else:
+ target_path = 'lib/node_modules/npm/'
# don't install npm if the target path is a symlink, it probably means
# that a dev version of npm is installed there
@@ -99,7 +102,10 @@ def npm_files(action):
if action == uninstall:
action([link_path], 'bin/npm')
elif action == install:
- try_symlink('../lib/node_modules/npm/bin/npm-cli.js', link_path)
+ if os.path.isdir('/usr/lib64'):
+ try_symlink('../lib64/node_modules/npm/bin/npm-cli.js', link_path)
+ else:
+ try_symlink('../lib/node_modules/npm/bin/npm-cli.js', link_path)
if os.environ.get('PORTABLE'):
# This crazy hack is necessary to make the shebang execute the copy
# of node relative to the same directory as the npm script. The precompiled
@@ -142,7 +148,10 @@ def files(action):
action([output_prefix + output_file], 'bin/' + output_file)
if 'true' == variables.get('node_use_dtrace'):
- action(['out/Release/node.d'], 'lib/dtrace/node.d')
+ if os.path.isdir('/usr/lib64/'):
+ action(['out/Release/node.d'], 'lib64/dtrace/node.d')
+ else:
+ action(['out/Release/node.d'], 'lib/dtrace/node.d')
# behave similarly for systemtap
action(['src/node.stp'], 'share/systemtap/tapset/')