为什么 npm install

编程入门 行业动态 更新时间:2024-10-27 02:29:26
本文介绍了为什么 npm install -g @angular/cli?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我知道有很多关于这个 npm 包安装的问题,但我找不到确切的相关答案,我已经安装了 npm 并且也在我的 VStudio 中开发了一些应用程序,每次在开发 angular 的新项目之前都做我们需要通过在 cmd 中输入npm install -g @angular/cli?

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?

推荐答案

一旦你全局安装了@angular/cli,在下一个项目中你只需要运行ng new app-name.此命令将创建一个名为app-name"的文件夹,然后将在本地安装所有依赖项 - 包括 @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.

全局安装@angular/cli 允许你在任何地方使用'ng'命令.需要在本地安装,因为对于您的项目,需要某些特定的 @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.

如果您的@angular/cli 全局版本比本地项目版本新,例如,当您运行 'ng serve' 时,'ng' 将使用本地 @angular/cli 代替.

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.

恢复:使用npm install -g @angular/cli安装后,你只需要运行ng new app-name.

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

更多推荐

为什么 npm install

本文发布于:2023-06-08 14:29:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/583083.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:npm   install

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!