Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve doc for Mac OS (Ventura) with homebrew #768

Closed
elmar-hinz opened this issue Jun 2, 2023 · 6 comments
Closed

Improve doc for Mac OS (Ventura) with homebrew #768

elmar-hinz opened this issue Jun 2, 2023 · 6 comments
Assignees
Labels
docs Changes to README or other documentation

Comments

@elmar-hinz
Copy link

elmar-hinz commented Jun 2, 2023

Summary

In the PATH /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin: ... /opt/homebrew/bin comes before /usr/local/bin. As long as there are node, npm or npx in the homebrew part, n will not work as expected.

Details

If the user should not fiddle with the path, homebrew has to give up control of node. That in turn means brew install n is a good way to get n installed.

There are other issues. A mere brew uninstall node is not enough. It does not remove npm and npx.

Solution

This did work for me:

# removing bin/npm and bin/npx
npm uninstall -g npm

# removing bin/node
brew uninstall node

# installing n
brew install n

# installing node
sudo n install latest

# some checks
which node
which npm
which npx
@shadowspawn
Copy link
Collaborator

There can be problems in general with multiple installs of node to different locations. This comes up with Homebrew on Apple Silicon Macs, but not with Intel Macs.

https://docs.brew.sh/Installation

This script installs Homebrew to its default, supported, best prefix (/usr/local for macOS Intel, /opt/homebrew for Apple Silicon and /home/linuxbrew/.linuxbrew for Linux) ...

Changing the install location takes extra work if you already have some global npm packages installed (like npm itself!), as they will also need uninstalling from the old location and installing in the new location.

@shadowspawn shadowspawn changed the title Improve doc for Mac OS (Venture) with homebrew Improve doc for Mac OS (Ventura) with homebrew Jun 6, 2023
@shadowspawn shadowspawn added the docs Changes to README or other documentation label Jun 10, 2023
@shadowspawn
Copy link
Collaborator

shadowspawn commented Dec 2, 2023

In a general sense, the problem here is multiple installs of node/npm/npx. n does warn about a shadowed version of node but not of a shadowed version of npm.

Would it help if n warned about npm being shadowed? (Previously suggested in: #762)

@shadowspawn
Copy link
Collaborator

Or are people liking this issue more interested in specific help about transitioning in Homebrew?

(I wonder if the n formula could offer suggestions, but not sure if that is appropriate for formula. I am a light user of Homebrew and do see some tips when installing products.)

@shadowspawn
Copy link
Collaborator

Something I have been thinking about is transferring global packages. That just came up in #800.

@shadowspawn
Copy link
Collaborator

I opened a PR with a detailed walk-through of switching from Homebrew managed Node.js to n managed Node.js as the example.

See #802

@shadowspawn shadowspawn self-assigned this Apr 21, 2024
@shadowspawn shadowspawn added pending release Merged into a branch for a future release, but not released yet and removed pending release Merged into a branch for a future release, but not released yet labels May 9, 2024
@shadowspawn
Copy link
Collaborator

Merged #802 onto master (without doing a release as such).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Changes to README or other documentation
Projects
None yet
Development

No branches or pull requests

2 participants