NS 8.9.3 not upgrading to 9.0.1 on MacOS
Issue Description
As with all previous updates to Nativescript I have used npm install -g nativescript and the upgrade has worked. In this instance, its not. The Upgrade appears to run, message after running the above is "added 1 package and changed 583 packages", but then ns -v returns 8.9.3 again.
which ns returns /opt/homebrew/bin/ns. Not sure whats going wrong.
npm -v 11.6.1 node -v 24.10.0
Reproduction
No response
Relevant log output (if applicable)
Environment
No response
Please accept these terms
- [x] I have searched the existing issues as well as StackOverflow and this has not been posted before
- [x] This is a bug report
- [x] I agree to follow this project's Code of Conduct
Do npm list -g.
This will produce something like
/Users/theuser/.nvm/versions/node/v24.11.1/lib
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
If [email protected] is there then it did install.
Then the issue is that /opt/homebrew/bin/ns appears in your path before the bin directory of your current node.
Hi thanks for the response.
npm list -g returns
/Users/me/.nvm/versions/node/v24.10.0/lib
├── [email protected]
├── [email protected]
└── [email protected]
My .zshrc file has this for homebrew
/opt/homebrew/bin:/opt/homebrew/sbin in that order, what path should I be using. Only ever followed the Nativescript installation instructions.
Edit: a quick search at OS level returned ./.nvm/versions/node/v24.10.0/lib/node_modules/nativescript/bin/ns which is the newly installed version, so why is it ignoring the homebrew path which I've always used.
Followed the advice here https://blog.nativescript.org/nativescript-9-announcement/#tl%3Bdr-—-updating-to-nativescript-9.0
Your current node was installed via nvm. When you install nvm it tries to put a script in the start up scripts to set the paths correctly.
i.e. as described here: https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script ( for whatever version of nvm you are using).
These scripts are missing, or the homebrew path is before the nvm paths in $PATH. I am guessing that you have a version of node installed through homebrew and one installed through nvm. So either change the path order, or uninstall the node installed through homebrew.
My .zshrc file contains the following nvm entries, homebrew/opt/nvm
export NVM_DIR="$HOME/.nvm" [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion export PATH="/usr/local/opt/[email protected]/libexec/bin:$PATH" export PATH="$HOME/.cargo/bin:$PATH" export VCPKG_ROOT=$HOME/vcpkg export PATH="$PATH:/Users/nick/dev/tooling/flutter/bin" export PATH="/opt/homebrew/opt/llvm/bin:$PATH" export LDFLAGS="-L/opt/homebrew/opt/llvm/lib" export CPPFLAGS="-I/opt/homebrew/opt/llvm/include" export PATH="$PATH":"$HOME/.pub-cache/bin" export PATH=/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/lib/ruby/gems/3.3.0/bin:$PATH
Ah nvm is installed through HomeBrew, I am not sure how that is supposed to work, you may have better luck with installing nvm their recommended way ( they say on their readme they do not support home-brew)
At the end of the day the issue is that /opt/homebrew/bin/ns does not link to ./.nvm/versions/node/v24.10.0/lib/node_modules/nativescript/bin/ns so you could always just change that.
Personally I'd uninstall nvm from hombrew and install it using their recommended method. I've used it this way for years.
OK, I've left as is at the moment, strange how Nativescript still refers to using Homebrew for installing nvm. At the moment I have just updated the symbolic link in /opt/homebrew/bin to the new nvm install path, upgraded a project, rebuilt and so far so good.
Thanks for the heads up.