英文:
I want to download angular v14 but I get angular v15
问题
我想下载 Angular v14,但我得到了 Angular v15(附注:我已经尝试过 npm install -g @angular/cli@14)
npm install -g @angular/cli@14
我仍然得到版本 15。
英文:
I want to download angular v14 but I get angular v15 (ps: I have already tried npm install -g @angular/cli@14)
npm install -g @angular/cli@14
i got version 15 still
答案1
得分: 1
首先,建议检查全局安装。
npm ls -g --depth=0
C:\Program Files\nodejs -> .\
+-- corepack@0.10.0
`-- npm@8.1.0
然后安装它。
npm install -g @angular/cli@14
或者如果您需要更多信息,可以使用以下选项进行安装
npm install -g @angular/cli@14 --loglevel verbose
C:\test>npm install -g @angular/cli@14
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
added 210 packages, and audited 212 packages in 8s
found 0 vulnerabilities
再次检查。
C:\test>npm ls -g --depth=0
C:\Program Files\nodejs -> .\
+-- @angular/cli@14.2.10
+-- corepack@0.10.0
`-- npm@8.1.0
看起来没有问题,但我知道有时候 Node 可能不会正确工作。
请确保首先基于当前目录检查 node_modules。全局安装的 angular-cli 和当前目录安装的 angular-cli 可能会不同。
让我们尝试这个(如果您有足够的时间)。
C:\test>ng v
? Would you like to share pseudonymous usage data about this project with the Angular Team
at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more
details and how to change this setting, see https://angular.io/analytics. No
Global setting: disabled
Local setting: No local workspace configuration file.
Effective status: disabled
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | ' _ \ / _` | | | | |/ _` | ' __ | | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | | | |___| |___ | |
/_/ \_\_ | | _ | \__ | \__ | _ | \__ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
<details>
<summary>英文:</summary>
First of all, It's good idea check global installation.
```npm ls -g --depth=0```
C:\test>npm ls -g --depth=0
C:\Program Files\nodejs -> .
+-- corepack@0.10.0
`-- npm@8.1.0
And install it.
```npm install -g @angular/cli@14```
or if you need more info, with options ```npm install -g @angular/cli@14 --loglevel verbose```
C:\test>npm install -g @angular/cli@14
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
added 210 packages, and audited 212 packages in 8s
found 0 vulnerabilities
Check again.
C:\test>npm ls -g --depth=0
C:\Program Files\nodejs -> .
+-- @angular/cli@14.2.10
+-- corepack@0.10.0
`-- npm@8.1.0
It looks fine there is no problems but I know sometimes node not work for us correctly.
Plese make sure that node_modules checked based on current directories first.
The angular-cli installed globally and the angular-cli installed in the current directory can be different.
let's try this(if you have enough time).
C:\test>ng v
? Would you like to share pseudonymous usage data about this project with the Angular Team
at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more
details and how to change this setting, see https://angular.io/analytics. No
Global setting: disabled
Local setting: No local workspace configuration file.
Effective status: disabled
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / | | | | |/ _
| '__| | | | | | |
/ ___ | | | | (| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/
Angular CLI: 14.2.10
Node: 16.12.0
Package Manager: npm 8.1.0
OS: win32 x64
Angular:
...
Package Version
@angular-devkit/architect 0.1402.10 (cli-only)
@angular-devkit/core 14.2.10 (cli-only)
@angular-devkit/schematics 14.2.10 (cli-only)
@schematics/angular 14.2.10 (cli-only)
C:\test>npm install @angular/cli@15
...
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
added 225 packages, and audited 226 packages in 21s
27 packages are looking for funding
run npm fund
for details
found 0 vulnerabilities
C:\test>dir
...
2023-02-08 10:30 <DIR> .
2023-02-08 10:30 <DIR> ..
2023-02-08 10:30 <DIR> node_modules
2023-02-08 10:30 168,293 package-lock.json
2023-02-08 10:30 58 package.json
C:\test>ng v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / | | | | |/ _
| '__| | | | | | |
/ ___ | | | | (| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/
Angular CLI: 15.1.4
Node: 16.12.0
Package Manager: npm 8.1.0
OS: win32 x64
Angular: undefined
...
Package Version
@angular-devkit/architect 0.1501.4
@angular-devkit/core 15.1.4
@angular-devkit/schematics 15.1.4
@angular/cli 15.1.4
@schematics/angular 15.1.4
C:\test>npm ls -g --depth=0
C:\Program Files\nodejs -> .
+-- @angular/cli@14.2.10
+-- corepack@0.10.0
`-- npm@8.1.0
C:\test>
</details>
# 答案2
**得分**: 0
如果您遇到上述问题,我建议卸载 Angular CLI,然后重新安装它。务必清除缓存。
按照以下步骤操作:
```bash
npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli@14
ng version
英文:
If you have the above issue, I recommend uninstalling the angular CLI and installing it again. Clear the cache MUST.
Follow these steps:
npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli@14
ng version
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论