問題描述
即使我通過瀏覽器下載了最新的穩定版本,為什麼我的 ubuntu 終端 v10 中的節點版本仍然存在? (Why is my node version in my ubuntu terminal v10 even though I downloaded the latest stable version through browser?)
$ node ‑v
v10.19.0
$ npm ‑v
: not foundram Files/nodejs/npm: 3:
: not foundram Files/nodejs/npm: 5 : /mnt/c/Program Files/nodejs/npm: 6: 語法錯誤:單詞意外(期待“in”)
參考解法
方法 1:
I would recommend installing Node with nvm.
download NVM using following command on terminal curl ‑o‑ https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
verify nvm is installed using nvm ‑‑version
install the required node version using nvm install 12.14.1
and then use the installed version using nvm use 12.14.1
方法 2:
Try running sudo apt‑get update
in your Ubuntu terminal.
Then run sudo apt‑get upgrade
and look to see if any packages were modified.
If that doesn't work, try installing node.js directly from the command line using sudo apt‑get install nodejs
. Then check your version again with node ‑v
and see if there are any changes.
Here's a reference
Additionally, here is an article explaining in detail how to add both node and npm directly from the command line
I prefer whenever possible to use the command line for installs, especially on Windows subsystem for Linux where not every package is compatible just yet. That should get you somewhere in this vicinity.
(by Ryan Christopher EDQUILA、Deepak Poojari、killshot13)