[英]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
v10.19.0
$ npm -v
: not foundram Files/nodejs/npm: 3:
: 未找到文件/nodejs/npm: 3:
: not foundram Files/nodejs/npm: 5: /mnt/c/Program Files/nodejs/npm: 6: Syntax error: word unexpected (expecting "in"):未找到ram Files/nodejs/npm:5:/mnt/c/Program Files/nodejs/npm:6:语法错误:单词意外(期待“in”)
I would recommend installing Node with nvm.我建议使用 nvm 安装 Node。
download NVM using following command on terminal在终端上使用以下命令下载 NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
bash
verify nvm is installed using nvm --version
使用
nvm --version
验证 nvm 是否已安装
install the required node version using nvm install 12.14.1
and then use the installed version using nvm use 12.14.1
使用
nvm install 12.14.1
安装所需的节点版本,然后使用已安装的版本使用nvm use 12.14.1
Try running sudo apt-get update
in your Ubuntu terminal.尝试在 Ubuntu 终端中运行
sudo apt-get update
。
Then run sudo apt-get upgrade
and look to see if any packages were modified.然后运行
sudo apt-get upgrade
并查看是否有任何软件包被修改。
If that doesn't work, try installing node.js directly from the command line using sudo apt-get install nodejs
.如果这不起作用,请尝试使用
sudo apt-get install nodejs
。 Then check your version again with node -v
and see if there are any changes.然后使用
node -v
再次检查您的版本,看看是否有任何更改。
Here'sa reference这是一个参考
Additionally, here is an article explaining in detail how to add both node and npm directly from the command line另外,这里有一篇文章详细解释了如何直接从命令行添加节点和 npm
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.我更喜欢尽可能使用命令行进行安装,尤其是在 Linux 的 Windows 子系统上,并不是每个 package 都兼容。 That should get you somewhere in this vicinity.
这应该让你在附近的某个地方。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.