Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I link node@6 by force?

Is it ok to link node@6 by force?

$ which node
$ echo $?
1

$ brew link node
Error: No such keg: /usr/local/Cellar/node

$ brew search node
leafnode          llnode            node              node-build        [email protected]         [email protected]         node@4            node@5            node@6 ✔          nodebrew          nodeenv           nodenv
Caskroom/cask/mindnode-pro          Caskroom/cask/node-profiler         Caskroom/cask/nodebox               Caskroom/cask/nodeclipse            Caskroom/cask/printnode             Caskroom/cask/soundnode

$ brew link node@6
Warning: node@6 is keg-only and must be linked with --force
Note that doing so can interfere with building software.

Edit:

I went ahead and did it:

$ brew link node@6 --force
Linking /usr/local/Cellar/node@6/6.9.5... 7 symlinks created

node and npm work fine now. Scary warning.

like image 435
Eric Francis Avatar asked Feb 02 '17 14:02

Eric Francis


People also ask

Is node 12 backwards compatible?

Node. js versions are mostly backward compatible, meaning that code you wrote for Node 8 will work on Node 10 or 12. Thus, if you only have plain old JavaScript you should face no difficulties upgrading.

Can you specify node version in package JSON?

Use the engines keyword in the package. json file to specify the Node. js version that you want your application to use. You can also specify a version range using npm notation.


2 Answers

I ran in to the same problem and followed the advice of brew info node@6 and added export PATH="/usr/local/opt/node@6/bin:$PATH to my .bash_profile. All the command line tools worked as expected.

(I've actually removed that line for my .bash_profile now and added an alias to set the path manually when I need it.)

like image 98
hrunk Avatar answered Sep 24 '22 17:09

hrunk


You may (I have) run into some Cellar issues..

What is the output you got from brew doctor?

I had this when executing brew doctor:

Warning: Some keg-only formula are linked into the Cellar. Linking a keg-only formula, such as gettext, into the cellar with brew link <formula> will cause other formulae to detect them during the ./configure step. This may cause problems when compiling those other formulae.

I had to execute brew unlink node@6 for it to return 'your system is ready to brew'.

like image 29
Cookra Avatar answered Sep 24 '22 17:09

Cookra