aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorMike McQuaid2014-10-26 12:47:12 +0000
committerMike McQuaid2014-10-26 13:30:51 +0000
commitcd21a535b2939b5c02abe60510fbcb4ccc700306 (patch)
tree5d04fe9183b5ca716725d1e12e7a25e3823f90bc /Library/Formula
parent5c8ce7b3be0a275ba8805b1f07f9f5f398cf16ac (diff)
downloadhomebrew-cd21a535b2939b5c02abe60510fbcb4ccc700306.tar.bz2
node: make sure node can be found by npm.
In case the PATH isn't setup correctly by users.
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/node.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/Library/Formula/node.rb b/Library/Formula/node.rb
index 30b003afb..f67f4e8e4 100644
--- a/Library/Formula/node.rb
+++ b/Library/Formula/node.rb
@@ -56,8 +56,11 @@ class Node < Formula
npmrc = npm_root/"npmrc"
npmrc.atomic_write("prefix = #{HOMEBREW_PREFIX}\n")
+ # make sure npm can find node
+ ENV["PATH"] = "#{opt_bin}:#{ENV["PATH"]}"
+
ENV["NPM_CONFIG_USERCONFIG"] = npmrc
- npm_root.cd { system "make", "install" }
+ npm_root.cd { system "make", "VERBOSE=1", "install" }
system "#{HOMEBREW_PREFIX}/bin/npm", "install", "--global", "npm@latest",
"--prefix", HOMEBREW_PREFIX
@@ -90,6 +93,12 @@ class Node < Formula
assert_equal "hello", output
assert_equal 0, $?.exitstatus
- system "#{HOMEBREW_PREFIX}/bin/npm", "install", "npm@latest" if build.with? "npm"
+ if build.with? "npm"
+ # make sure npm can find node
+ ENV.prepend_path "PATH", opt_bin
+ assert_equal which("node"), opt_bin/"node"
+ assert (HOMEBREW_PREFIX/"bin/npm").executable?, "npm must be executable"
+ system "#{HOMEBREW_PREFIX}/bin/npm", "--verbose", "install", "npm@latest"
+ end
end
end