nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Install latest nvm for node version 12.22.6

gabitianu opened this issue · comments

Operating system and version:

nvm debug output:

nvm --version: v0.39.1 $TERM_PROGRAM: Apple_Terminal $SHELL: /bin/zsh $SHLVL: 1 whoami: 'I327776' ${HOME}: /Users/I327776 ${NVM_DIR}: '${HOME}/.nvm' ${PATH}: ${NVM_DIR}/versions/node/v12.22.6/bin:/usr/local/bin/apache-maven-3.6.3/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion Tech Preview.app/Contents/Public:/Library/Apple/usr/bin:/Applications/Privileges.app/Contents/Resources:${HOME}/Apps/neo/tools:~/Apps $PREFIX: '' ${NPM_CONFIG_PREFIX}: '' $NVM_NODEJS_ORG_MIRROR: '' $NVM_IOJS_ORG_MIRROR: '' shell version: 'zsh 5.8.1 (x86_64-apple-darwin22.0)' uname -a: 'Darwin 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64' checksum binary: 'sha256sum' OS version: macOS 13.0.1 22A400 curl: /usr/bin/curl, curl 7.84.0 (x86_64-apple-darwin22.0) libcurl/7.84.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.47.0 wget: /opt/homebrew/bin/wget, GNU Wget 1.21.3 built on darwin21.3.0. sed: /usr/bin/sed cut: /usr/bin/cut basename: /usr/bin/basename rm: /bin/rm mkdir: /bin/mkdir xargs: /usr/bin/xargs git: /usr/bin/git, git version 2.37.1 (Apple Git-137.1) ls: grep:: No such file or directory grep: grep: aliased to grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}), grep (BSD grep, GNU compatible) 2.6.0-FreeBSD awk: /usr/bin/awk, awk version 20200816 nvm current: v12.22.6 which node: ${NVM_DIR}/versions/node/v12.22.6/bin/node which iojs: iojs not found which npm: ${NVM_DIR}/versions/node/v12.22.6/bin/npm npm config get prefix: ${NVM_DIR}/versions/node/v12.22.6 npm root -g: ${NVM_DIR}/versions/node/v12.22.6/lib/node_modules

nvm ls output:

v8.17.0 v10.22.0 v12.18.4 -> v12.22.6 v14.17.6 v14.19.1 default -> 12.22.6 (-> v12.22.6) iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v14.19.1) (default) stable -> 14.19 (-> v14.19.1) (default) lts/* -> lts/gallium (-> N/A) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 lts/dubnium -> v10.24.1 (-> N/A) lts/erbium -> v12.22.12 (-> N/A) lts/fermium -> v14.19.1 lts/gallium -> v16.15.0 (-> N/A)

How did you install nvm?

brew

What steps did you perform?

nvm install-latest-npm

What happened?

Attempting to upgrade to the latest working version of npm...

  • Installing latest npm; if this does not work on your node version, please report a bug!
    npm ERR! code EBADENGINE
    npm ERR! engine Unsupported engine
    npm ERR! engine Not compatible with your version of node/npm: npm@9.2.0
    npm ERR! notsup Not compatible with your version of node/npm: npm@9.2.0
    npm ERR! notsup Required: {"node":"^14.17.0 || ^16.13.0 || >=18.0.0"}
    npm ERR! notsup Actual: {"npm":"8.19.1","node":"v12.22.6"}

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/I327776/.npm/_logs/2022-12-10T11_29_41_781Z-debug-0.log

  • npm upgraded to: v8.19.1

What did you expect to happen?

I expected to have npm version 8.19.3, but got error instead

Is there anything in any of your profile files that modifies the PATH?

To fix this issue, yo need to upgrade your version of Node.js to a version that is compatible with the latest version of npm. You can do this by using nvm to install the latest version of Node.js on your system. and before that install nvm too if not already installed
$brew install nvm
once done do this
$nvm install-latest-npm
this will install the latest version in your system.
after this you will not encounter the "Unsupported engine" error.

if it is the path related issue I believe installing 'nvm' using 'brew' will take care it, it will be added to the path variable directly.

Definitely do not install either nvm or node with brew.

@gabitianu nvm is unsupported when installed with homebrew. I suggest removing it and installing it properly with bot instructions in the readme.

You’re also using an older version of nvm; v0.39.2 is latest.

To fix this issue, yo need to upgrade your version of Node.js to a version that is compatible with the latest version of npm. You can do this by using nvm to install the latest version of Node.js on your system. and before that install nvm too if not already installed $brew install nvm once done do this $nvm install-latest-npm this will install the latest version in your system. after this you will not encounter the "Unsupported engine" error.

if it is the path related issue I believe installing 'nvm' using 'brew' will take care it, it will be added to the path variable directly.

nvm install-latest-npm is supposed to install the latest npm available for the current node, it should work with any version, not just the latest

My bad, npm was installed correctly, not through brew, but it was not updated to the latest version. After upgrade, I see the expected message: * npm upgraded to: v8.19.3.
It's a pity that you don't support nvm through homebrew, maybe you'll consider it in the future.

I doubt I will ever consider it; I don't distribute nvm on homebrew, thus it shouldn't be installed via homebrew - and I have no plans to start using homebrew such that i'd want to distribute nvm on it.