Skip to content

Commit

Permalink
Use process.execPath within node to find path name
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgebucaran committed Dec 29, 2020
1 parent 09547f8 commit 15026bb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions functions/nvm.fish
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ function _nvm_current
end

function _nvm_node_info
set --local npm_pkg_json (realpath (command --search npm))
set --local npm_path (string replace bin/npm-cli.js "" (realpath (command --search npm)))
command node --eval "
console.log(process.version)
console.log(require('"(string replace bin/npm-cli.js package.json $npm_pkg_json)"').version)"
command --search node | string replace ~ \~
console.log(require('"$npm_path"/package.json').version)
console.log(process.execPath.replace(os.homedir(), '~'))
"
end

0 comments on commit 15026bb

Please sign in to comment.