diff mbox

[3/4] package/nodejs: Add global node_module to the PATH

Message ID 1434298376-31893-3-git-send-email-martin@barkynet.com
State Superseded
Headers show

Commit Message

Martin Bark June 14, 2015, 4:12 p.m. UTC
This patch adds /usr/lib/node_modules/.bin to PATH so that global
node_modules are accessible from the command line

Signed-off-by: Martin Bark <martin@barkynet.com>
---
 package/nodejs/nodejs.mk | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox

Patch

diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 59e03b0..5d95f77 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -111,6 +111,11 @@  define NODEJS_INSTALL_MODULES
 		$(HOST_DIR)/usr/bin/npm install \
 		$(NODEJS_MODULES_LIST) \
 	)
+
+	# Add global node_modules to PATH
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/profile.d
+	printf "export PATH=\x24PATH:/usr/lib/node_modules/.bin\n" \
+		>$(TARGET_DIR)/etc/profile.d/node_modules.sh
 endef
 endif