【问题标题】:Git clone Angular Cli project show that you are not in the projectgit clone Angular Cli项目显示你不在项目中
【发布时间】:2017-09-03 20:04:52
【问题描述】:

我一直在为 Angular cli 苦苦挣扎,因为它一直给我一个错误,即我不在 angular cli 项目中。

想设置这个项目https://github.com/codediodeio/ngrx-fire

I followed the basics:
git clone https://github.com/codediodeio/ngrx-fire.git ngrxFire
cd ngrxFire
npm install

然后 ng 服务,告诉我我不在项目中,我是 100%。 当我在做 Angular cli 项目时,我的机器上是否有我通常需要更新的配置?

【问题讨论】:

  • 您是否创建了src/environments/environment.ts 文件?顺便说一下,请提供您得到的确切错误。
  • 是的,我已经知道了如何运行它,稍后会发布
  • 你的全局 Angular cli 版本是多少?
  • 最新的,当我遇到代码问题时总是尝试使用最新的

标签: angular-cli cloning


【解决方案1】:

我找到了一种设置方法,不确定您是否这样做以及问题所在,但它确实有效。这些日子之一:

所以你照常做:

git clone https://github.com/codediodeio/ngrx-fire.git ngrxFire

cd ngrxFire

但比你

rm -rf node_modules dist tmp
npm install --save-dev angular-cli@latest
npm install
npm init

在 ng init 说不不覆盖任何东西时,它会尖叫的下一个问题是带有 promise 和 polyfill 的东西,所以你需要运行一个命令:

npm install promise-polyfill --save-exact

您会注意到它在应用程序的根目录中创建了一个环境文件夹,因此在 module.ts 中将其重新指向正确的文件夹。

你需要在 firebase 中做两件事: 1)更改Authentication中的设置,以便匿名用户可以连接并将db中的规则更改为

{
    "rules": {    
        ".read": true,
        ".write": true
    }
}

你可以运行 ng-serve。现在为什么这项工作,如果有人能解释我会给那个角色买一杯饮料。为什么 angular-cli 会这样冲突?

【讨论】:

    【解决方案2】:

    在运行 npm install 之前,请执行以下操作:

    $ npm cache clean --force
    $ npm install -g npm
    

    然后

    $ npm install
    

    【讨论】:

      【解决方案3】:

      没有ng init 的命令。您能否确认您遵循的步骤。 来自ng init 的输出:

      The specified command init is invalid. For available options, see ng help.

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-11-14
        • 2011-11-10
        • 1970-01-01
        • 1970-01-01
        • 2015-08-02
        • 1970-01-01
        • 2018-09-27
        • 2017-05-13
        相关资源
        最近更新 更多