简体   繁体   English

Node JS 在创建应用程序时显示旧版本

[英]Node JS showing older version while creating the application

I am trying to upgrade my existing angular project from angular 8 to angular 13. and my current node version is 15.3.0.我正在尝试将我现有的 angular 项目从 angular 8 升级到 angular 13。我当前的节点版本是 15.3.0。

so it was showing error to upgrade node version to >=16 then i upgraded node to 16.10.因此将节点版本升级到> = 16时显示错误,然后我将节点升级到16.10。 now when I am running command to update @angular/cli its throwing error like node js version 15.3.0 detected,现在,当我运行命令来更新@angular/cli 它的抛出错误,如检测到节点 js 版本 15.3.0,

Even while creating new app same error is coming.即使在创建新应用程序时也会出现同样的错误。

I uninstalled the old node 15.3.0 and installed new version 16.10 but still its showing same error.我卸载了旧节点 15.3.0 并安装了新版本 16.10,但仍然显示相同的错误。

But when we run node -v its showing 16.10,same when we open node js command prompt.但是当我们运行 node -v 它显示 16.10 时,当我们打开 node js 命令提示符时也是如此。

Only for the project creation / update angular cli it shows version 15.3.0 detected.仅用于项目创建/更新 angular cli 它显示检测到版本 15.3.0。

is there any specific reason?有什么具体原因吗?

Node js command prompt shows:: Node js 命令提示符显示:: 在此处输入图像描述

but while creating app shows error::但是在创建应用程序时显示错误::

在此处输入图像描述

try closing the terminal and open it again as administrator.尝试关闭终端并以管理员身份再次打开它。 had the same issue and it worked for me well.有同样的问题,它对我很有效。

otherwise you could try installing node via nvm (Node Version Manager):否则您可以尝试通过 nvm(节点版本管理器)安装节点:

todo:去做:

  1. Install nvm Node Version Manager安装 nvm节点版本管理器
  2. run nvm install 16运行nvm install 16
  3. check if version is installed with: nvm ls检查版本是否安装: nvm ls
  4. switch default version to nvm alias default 16.10.0将默认版本切换为nvm alias default 16.10.0
  5. check current version with: node -v检查当前版本: node -v

if its printing your desired version it should work well.如果它打印您想要的版本,它应该可以正常工作。

Make sure to restart your terminal after making the changes...确保在进行更改后重新启动终端...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM