Executed these commands:
sudo npm cache clean -f sudo npm install -gn sudo n stable node -v shows 4.6.2 but should be at least 8.0.0 or am i wrong?
sudo node -v also displays 8.0.0 , as expected, but why only with sudo ?
Executed these commands:
sudo npm cache clean -f sudo npm install -gn sudo n stable node -v shows 4.6.2 but should be at least 8.0.0 or am i wrong?
sudo node -v also displays 8.0.0 , as expected, but why only with sudo ?
What is the system? In Ubuntu, for example, there are different branches, 6. *, 7. *, 8. *, etc. There is also a tool to manage this. The version node (for example) 6.3.1 can be upgraded to 6.3.2, despite the fact that there are already 7. *, 8. *, etc.
n is this tool. - D-sideTry to demolish the old version and add manually the repositories for the new branch (at the time of installation, you can disable all others, then enable):
curl -sL https://deb.nodesource.com/setup_8.x | -E bash – I suppose the point is that in your list of repositories there are only old lists of the node (this is often found if you do not manually register the node repository).
sudo n stable Oh, you have n . The version manager, executed by the technology, “put the necessary version in the home folder and change the environment variables so that this version is used by default”, which is convenient for development. From the same series RVM, rbenv, GVM.
The fact is that sudo starts a new shell session on behalf of another user. In this case, root . And configuration changes (new installed versions, default version) are saved in its folders and are relevant only for shell sessions on its behalf (or with its configuration; I have never seen it done so, but I don’t see what is stopping it) .
Using n with sudo , you change the environment for root , not for yourself.
Source: https://ru.stackoverflow.com/questions/683891/
All Articles
sudo node -v? - D-siden stable(withoutsudo) work? - D-sidenode -v? - D-side