为什么npm install -g @ angular / cli? [英] Why npm install -g @angular/cli?

查看:416
本文介绍了为什么npm install -g @ angular / cli?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有关安装此npm软件包的问题很多,但我找不到确切的相关答案,我已经安装了npm并在VStudio中开发了很少的应用程序,每次开发有角度的新项目之前我们需要通过在cmd中键入以下内容来再次安装npm: npm install -g @ angular / cli?

解决方案

@ angular / cli全局,在下一个项目中,您只需要运行 ng新的应用程序名称
此命令将创建一个名为 app-name的文件夹,



全局安装@ angular / cli允许您在任何地方使用'ng'命令。需要在本地安装,因为



如果您的项目的@ angular / cli版本比本地项目版本新,则



ng'将使用本地@ angular / cli代替,当您



恢复:使用 npm install -g @ angular / cli ,则只需运行 ng个新的应用程序名称


I know there are lot many question regarding this npm package installing but I couldn't find the exact relevant answer, I have already installed npm and also developed few applications in my VStudio, Every time before developing the new project of angular do we need to install npm again by typing this in cmd "npm install -g @angular/cli?

解决方案

Once you have installed @angular/cli globally, in the next project you just need run ng new app-name. This command will create a folder named 'app-name', than will install all dependencies locally - including @angular/cli.

Installing @angular/cli globally allow you to use 'ng' command everywhere. It's required to install locally because to your project, some specific @angular/cli version is required and newer versions maybe brake.

If your @angular/cli global is newer than the local project version, 'ng' will use the local @angular/cli instead, when you run 'ng serve', for example.

Resume: after installed using npm install -g @angular/cli, you will need just to run ng new app-name.

这篇关于为什么npm install -g @ angular / cli?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆