Skip to content

Commit

Permalink
add special case for Homebrew; test on osx
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Apr 26, 2019
1 parent cb13b72 commit 7f83822
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
os:
- linux
- osx
language: node_js
node_js:
- '10'
- '8'
before_install:
- if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then brew install "node@${TRAVIS_NODE_VERSION}" && export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig" && nvm use system; fi;
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const defaultNpmPrefix = (() => {
return path.dirname(process.execPath);
}

// Homebrew special case; always assume /usr/local
if (process.execPath.startsWith('/usr/local/Cellar/node')) {
return '/usr/local';
}

// `/usr/local/bin/node` → `prefix=/usr/local`
return path.dirname(path.dirname(process.execPath));
})();
Expand Down

0 comments on commit 7f83822

Please sign in to comment.