Angular cli更新后获取错误

时间:2017-02-10 13:35:43

标签: angular-cli

我的 angular-cli 版本为 beta.16

我尝试按照以下命令进行更新

func pageViewController(_ pageViewController: UIPageViewController,
                        viewControllerBefore viewController: UIViewController) -> UIViewController?
{
    // Return some VC based on what the current viewController param is.
}

func pageViewController(_ pageViewController: UIPageViewController,
                        viewControllerAfter viewController: UIViewController) -> UIViewController?
{
   // Return some VC based on what the current viewController param is.
}

func presentationCount(for pageViewController: UIPageViewController) -> Int {
    return 7
}

func presentationIndex(for pageViewController: UIPageViewController) -> Int {
    return viewControllers!.index(of: viewControllers!.first!)!
}

在我尝试运行任何ng命令后成功安装

npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@latest

我收到此错误

ng version 
ng help

2 个答案:

答案 0 :(得分:34)

您需要节点版本6.x或更高版本

看看这里:https://github.com/angular/angular-cli/issues/4604

答案 1 :(得分:1)

如上所述,您需要Node版本6.x或更高版本。

cdvillagra Github上发布的快速解决方案:

npm cache clean -f
npm install -g n
n stable

(您可能需要使用sudo为这些命令添加前缀。)

此外,在Ubuntu或类似网站上,您可能希望删除旧版本的节点,然后链接新节点:

sudo ln -s /usr/local/bin/node /usr/bin/node