diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index 09c5f9662..373870ee6 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -1099,7 +1099,7 @@ def node_preinstall_bin_path return @node_preinstall_bin_path if defined?(@node_preinstall_bin_path) legacy_path = "#{Dir.pwd}/#{NODE_BP_PATH}" - path = run("which node") + path = run("which node").chomp if path && $?.success? @node_preinstall_bin_path = path elsif run("#{legacy_path}/node -v") && $?.success? @@ -1117,7 +1117,7 @@ def node_not_preinstalled? def yarn_preinstall_bin_path return @yarn_preinstall_bin_path if defined?(@yarn_preinstall_bin_path) - path = run("which yarn") + path = run("which yarn").chomp if path && $?.success? @yarn_preinstall_bin_path = path else diff --git a/spec/hatchet/node_spec.rb b/spec/hatchet/node_spec.rb index dbd651844..7fd9c43d3 100644 --- a/spec/hatchet/node_spec.rb +++ b/spec/hatchet/node_spec.rb @@ -2,7 +2,17 @@ describe "Node" do it "works with node buildpack" do - Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git").deploy do |app| + before_deploy = Proc.new do + run!("rm .buildpacks") + run!("echo https://github.com/heroku/heroku-buildpack-nodejs.git >> .buildpacks") + run!("echo #{Hatchet::App.default_buildpack} >> .buildpacks") + end + + Hatchet::Runner.new( + "node_multi", + before_deploy: before_deploy, + buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git" + ).deploy do |app| expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2") expect(app.run("node -v")).to match("v4.1.2") end