作者:手机用户2502863445 | 来源:互联网 | 2022-12-07 16:29
我正在使用Ubuntu 18,并希望启动Angular 5项目,因此我通过以下命令安装了Node,npm,TypeScript,最后安装了最新的稳定Angular CLI,
sudo npm install -g @angular/cli
因此,默认情况下,它正在下载最新的稳定的Angular CLI,现在是6.1.3,默认情况下,它是Angular 6版本而不是Angular 5的版本,这是我的要求。
之后,我在同一页面上搜索了许多页面,以获取正确的CLI版本,以获得适用于Angular 5的最新版本5.2.11。
还看了很多帖子,但很多是从2017年Angular 5新发布的去年开始的。
所以我的问题是通过安装哪个较早版本的Angular CLI获取Angular 5最新版本?
1> ArifMustafa..:
操作系统:Ubuntu 18(Linux)
注意:sudo
用作安装前缀。Windows用户以管理员身份打开cmd。
sudo apt-get update
安装NodeJS 8.11.3 LTS
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v
v8.11.3
npm与Node.js一起安装
npm与Node.js一起分发,这意味着当您下载Node.js时,会自动在计算机上安装npm。
npm -v
6.3.0
获取TypeScript
sudo npm install -g typescript
tsc -v
Version 3.0.1
使用root安装angular / cli
sudo -s
root@ubuntu:~#
对Angular 5.2.11使用CLI版本1.6.6
root@ubuntu:~# npm install -g @angular/cli@1.6.6
// it will download files and take some minutes
root@ubuntu:~# ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ ? \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.6.6
Node: 8.11.3
OS: linux x64
Angular:
...
现在,从根目录退出
exit
// reach where you want to create your new project
ng new angular5App
// it will download files and take some minutes
到达项目目录内
cd angular5App
// check project dependencies from package.json
编译,捆绑并运行项目
ng serve -on
默认情况下,您的项目将在 http://localhost:4200/
在以上版本的Chrome 65中,转到检查,元素,
内部
检查