'How to brew install specific version of Node?

For example I want to install either 7.9 or 7.10 but want to avoid Node 8 due to the webpack node-sass breaking bug.

When I run brew search node this is what I see:

❯ brew search node leafnode llnode node ✔ node-build > [email protected] [email protected] node@4 node@6 nodebrew nodeenv nodenv caskroom/cask/node-profiler

If you meant "node" specifically: It was migrated from caskroom/cask to homebrew/core. You can access it again by running: brew tap homebrew/core

There is node which is checked (my current version is v7.4.0 then [email protected], [email protected], node@4 and node@6?

The reason I can't just fully upgrade to 8 is node-sass won't work in webpack.


Just installed NVM and got this crazy error log:

=> nvm source string already in /Users/leongaban/.zshrc => Appending bash_completion source string to /Users/leongaban/.zshrc npm ERR! missing: is-path-cwd@^1.0.0, required by [email protected] npm ERR! missing: is-path-in-cwd@^1.0.0, required by [email protected] npm ERR! missing: p-map@^1.1.1, required by [email protected] npm ERR! missing: pify@^3.0.0, required by [email protected] npm ERR! missing: rimraf@^2.2.8, required by [email protected] npm ERR! missing: bluebird@^3.1.1, required by [email protected] npm ERR! missing: clone@^1.0.2, required by [email protected]

...

=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:

If I'm reading this right, does this mean I can't use npm to globally install packages anymore and have to use nvm?

Update

I added the export lines to my .zshrc bash (I don't use bash_profile)

❯ nvm --version
0.33.2


Solution 1:[1]

There are two ways in the decision for using different version of Node. Second way is more convenient and practical by my opinion.


First way:

Install other Node version(for example 14) with using:

brew install node@14
brew unlink node
brew link node@14
node -v

PS You may use brew link with flag --overwrite, for example:

brew link --overwrite node@14

PS2 Why unlink and then link again?

Documentation:

Remove symlinks for formula from Homebrew's prefix. This can be useful for temporarily disabling a formula:

brew unlink formula && commands && brew link formula

In other words:

if you have both node and node@14 installed, where node is other version(..,15 or 16), so, for set active version 14:

you must unlink node and then link to new installed version 14
brew unlink node brew link node@14

Second way:

Install Node Version Manager(nvm) and select Node version:

nvm - github nvm - home brew

brew install nvm

mkdir ~/.nvm

export NVM_DIR="$HOME/.nvm"
    [ -s "$(brew --prefix)/opt/nvm/nvm.sh" ] && . "$(brew --prefix)/opt/nvm/nvm.sh" # This loads nvm
    [ -s "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" ] && . "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion

nvm install 14

nvm use 14

nvm list

Solution 2:[2]

To install the latest version of node and unlink the previously installed

brew install node@14
brew unlink node
brew link --overwrite node@14
echo 'export PATH="/usr/local/opt/node@14/bin:$PATH"' >> ~/.bash_profile
node -v

Solution 3:[3]

brew install --build-from-source node@14

Solution 4:[4]

Not really an elegant solution, but it works.

I imported the dataset into a helper sheet, where I combined the cell value with the corresponding value in Column A for each row ( a name in this case ) and the date from row 1 for each column, using underscore as a delimiter.

This new data range was then given a unique name, EE in this case.

On a second helper sheet, using this formula =INDEX(Filtered,1+INT((ROW('Sheet1'!C3)-1)/COLUMNS(Filtered)),MOD(ROW('Sheet1'!C3)-1+COLUMNS(Filtered),COLUMNS(Filtered))+1) and drag it down till it returns an REF! error and going back one row before the error.

This transposes all the data into a single column G. Using =UNIQUE(SORT(FILTER(B3:B3240,B3:B3240<> "",""))) then gives me a filtered list of unique values in column H that I then run

=IF(H3="","",LEFT(H3, SEARCH("_",H3,1)-1)) for the first data value in I, and

=IF(H3="","",MID(H3, SEARCH("_",H3) + 1, SEARCH("_",H3,SEARCH("_",H3)+1) - SEARCH("_",H3) - 1)) for the middle data value in J, and

=IF(H3="","",IFERROR(TEXT(RIGHT(H3,5),"yyyy-mm-dd"),"NF")) for the last data value in K.

Then just run XLOOPUP across columns I, J and K.

Runs quick and easy and solves a few of the other issue I had as well.

The second data set has just over 35 000 rows - still works well and fast.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 SangamAngre
Solution 3 MickJagger
Solution 4 Martin