同一台计算机上的angular-cli不同版本

问题描述:

我正在几个项目中使用Angular2.每个项目都使用不同版本的angular-cli,因此,我需要能够使用正确版本的angular-cli分别运行和编译以进行生产.当我使用save-dev在本地安装angular-cli时,找不到ng命令,因此无法为该项目创建内部版本.

I'm working with Angular2 in several projects. Each of this projects uses a different version of angular-cli, so, I need to be able to run and compile for production each separately with the correct version of angular-cli. When I installed angular-cli locally using save-dev, ng commands not found so I cannot create a build distribution for the project.

问题是,如何在同一计算机上具有多个angular-cli版本而不全局安装(使用-g选项)?是否可以在不全局安装angular-cli的情况下运行ng命令?

So the question are, how can I have multiples angular-cli version in the same machine, without installed globally (with -g option)?, it is possible run ng commands without installing angular-cli globally?

您可以使用 NVM 一个节点版本管理器,并允许您在每个节点版本中使用不同的全局模块.

You could use NVM which is a Node Version Manager and allows you to work with different global modules in each Node version.

就我而言,我在一个项目中使用Node 6.9.5和Angular2,在另一个项目中使用Node 10和Angular6.

In my case, I'm working with Node 6.9.5 and Angular2 in one project, and Node 10 and Angular6 in other.

您只需要注意安装哪个版本即可正常工作.

You only have to pay attention which version is seated and work as normally as you do.