【问题标题】:Angular commands not working after installing angular cli and setting path variable安装 Angular cli 并设置路径变量后,Angular 命令不起作用
【发布时间】:2021-09-29 13:48:37
【问题描述】:

当我尝试使用 Angular CLI 创建一个新项目时,使用:

n 应用程序

我收到此错误:

C:\Users\Venkateshwarn 
M\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng:26
                  );
                  ^
SyntaxError: Unexpected token )
     at createScript (vm.js:56:10)
     at Object.runInThisContext (vm.js:97:10)
     at Module._compile (module.js:542:28)
     at Object.Module._extensions..js (module.js:579:10)
     at Module.load (module.js:487:32)
     at tryModuleLoad (module.js:446:12)
     at Function.Module._load (module.js:438:3)
     at Module.runMain (module.js:604:10)
     at run (bootstrap_node.js:390:7)
     at startup (bootstrap_node.js:150:9)

如何升级或卸载 Angular CLI?

【问题讨论】:

标签: javascript node.js angular mongodb express


【解决方案1】:

要卸载 Angular cli,您可以使用以下命令:

npm uninstall -g @angular/cli
npm cache clean

您可以参考这篇文章获取更多知识:https://www.npmjs.com/package/@angular/cli

升级角度

对当前稳定版本进行基本更新:

ng update @angular/cli @angular/core

从一个主要版本更新到另一个:

ng update @angular/cli@^<major_version> @angular/core@^<major_version>

您可以参考这篇文章以获取更多信息:https://angular.io/cli/update

【讨论】:

    【解决方案2】:

    应该通过重新安装 Nodejs 和 Angular CLI 来解决,首先将两者都卸载,然后在重新安装结束时更新 Angular CLI。

    【讨论】:

    • 你能用英文写吗?
    • 没问题 :) 记住this ;)
    猜你喜欢
    • 2018-07-30
    • 2017-10-16
    • 1970-01-01
    • 1970-01-01
    • 2018-04-12
    • 2014-11-13
    • 2017-10-26
    • 1970-01-01
    • 2018-02-21
    相关资源
    最近更新 更多