Skip to content

Instantly share code, notes, and snippets.

@jukben
Created September 23, 2024 10:39
Show Gist options
  • Save jukben/9b8003155295b03539c48f57d43ecd24 to your computer and use it in GitHub Desktop.
Save jukben/9b8003155295b03539c48f57d43ecd24 to your computer and use it in GitHub Desktop.
/usr/local/bin/node
#!/usr/bin/env fish
# Get the current Node.js version managed by nvm.fish
set nvm_current_version (nvm current)
# Check if a Node.js version is currently selected
if test "$nvm_current_version" = "none"
echo "Error: No Node.js version selected. Please use 'nvm use' to select a version."
exit 1
end
# Build the path to the Node.js binary
set node_bin "$nvm_data/$nvm_current_version/bin/node"
# Check if the Node.js binary exists and is executable
if not test -x "$node_bin"
echo "Error: Node.js binary not found at $node_bin"
exit 1
end
# Execute Node.js with any passed arguments
exec "$node_bin" $argv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment