【问题标题】:Setting up ng-jhipster on a generated JHipster app在生成的 JHipster 应用程序上设置 ng-jhipster
【发布时间】:2018-04-15 14:04:45
【问题描述】:

我想将克隆的 ng-jhipster 项目配置为生成的 JHipster 应用程序的依赖项。

我正在使用以下版本(来自 jhipster info):

git version 2.15.0  
node: v6.11.5  
npm: 5.4.2  
yarn: 1.2.1  
yeoman: 2.0.0  

对于我新生成的 JHipster 应用程序,我正在执行以下步骤:
yarn global add generator-jhipster(我得到 v4.10.2)
mkdir ~/v4.10.2
cd ~/myNewGeneratedApp
jhipster:在这里我选择所有默认值(特别是 Angular 4)
yarn install 自动执行,一切正常)
然后我运行yarn start,一切都开始顺利。

对于我的 ng-jhipster,我正在执行以下步骤:
cd ~
git clone https://github.com/jhipster/ng-jhipster
cd ng-jhipster
git checkout v0.2.12(使用“相同”依赖版本来自 myNewGeneratedApp)

现在我正在阅读 ng-jhipster wiki 并运行:

yarn install
yarn run test  
yarn run build  
yarn link

我回到 myNewGeneratedApp 文件夹:

cd ~/myNewGeneratedApp 
yarn link ng-jhipster 

所以在 ~/myNewGeneratedApp/node_modules 中,文件夹 ng-jhipster 很好地链接到我的本地 ng-jhipster 项目。

现在当我运行yarn start 时出现以下错误:

ERROR in [at-loader] ./src/main/webapp/app/blocks/interceptor/auth-expired.interceptor.ts:7:14
        TS2415: Class 'AuthExpiredInterceptor' incorrectly extends base class 'JhiHttpInterceptor'.
      Types of property 'requestIntercept' are incompatible.
        Type '(options?: RequestOptionsArgs) => RequestOptionsArgs' is not assignable to type '(options?: RequestOptionsArgs) => RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.
          Types of parameters 'options' and 'options' are incompatible.
            Type 'RequestOptionsArgs' is not assignable to type 'RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.

ERROR in [at-loader] ./src/main/webapp/app/blocks/interceptor/auth.interceptor.ts:6:14
        TS2415: Class 'AuthInterceptor' incorrectly extends base class 'JhiHttpInterceptor'.
      Types of property 'requestIntercept' are incompatible.
        Type '(options?: RequestOptionsArgs) => RequestOptionsArgs' is not assignable to type '(options?: RequestOptionsArgs) => RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.
          Types of parameters 'options' and 'options' are incompatible.
            Type 'RequestOptionsArgs' is not assignable to type 'RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.

ERROR in [at-loader] ./src/main/webapp/app/blocks/interceptor/errorhandler.interceptor.ts:5:14
        TS2415: Class 'ErrorHandlerInterceptor' incorrectly extends base class 'JhiHttpInterceptor'.
      Types of property 'requestIntercept' are incompatible.
        Type '(options?: RequestOptionsArgs) => RequestOptionsArgs' is not assignable to type '(options?: RequestOptionsArgs) => RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.
          Types of parameters 'options' and 'options' are incompatible.
            Type 'RequestOptionsArgs' is not assignable to type 'RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.

ERROR in [at-loader] ./src/main/webapp/app/blocks/interceptor/http.provider.ts:20:9
        TS2345: Argument of type 'XHRBackend' is not assignable to parameter of type 'ConnectionBackend'.
      Types of property 'createConnection' are incompatible.
        Type '(request: Request) => XHRConnection' is not assignable to type '(request: any) => Connection'.
          Type 'XHRConnection' is not assignable to type 'Connection'.
            Types of property 'request' are incompatible.
              Type 'Request' is not assignable to type 'Request'. Two different types with this name exist, but they are unrelated.
                Types of property 'headers' are incompatible.
                  Type 'Headers' is not assignable to type 'Headers'. Two different types with this name exist, but they are unrelated.
                    Types have separate declarations of a private property 'mayBeSetNormalizedName'.

ERROR in [at-loader] ./src/main/webapp/app/blocks/interceptor/notification.interceptor.ts:6:14
        TS2415: Class 'NotificationInterceptor' incorrectly extends base class 'JhiHttpInterceptor'.
      Types of property 'requestIntercept' are incompatible.
        Type '(options?: RequestOptionsArgs) => RequestOptionsArgs' is not assignable to type '(options?: RequestOptionsArgs) => RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.
          Types of parameters 'options' and 'options' are incompatible.
            Type 'RequestOptionsArgs' is not assignable to type 'RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.
              Types of property 'headers' are incompatible.
                Type 'Headers' is not assignable to type 'Headers'. Two different types with this name exist, but they are unrelated.
                  Types have separate declarations of a private property 'mayBeSetNormalizedName'.

ERROR in [at-loader] ./src/main/webapp/app/shared/alert/alert-error.component.ts:25:9
        TS90010: Type 'Subscription' is not assignable to type 'Subscription'. Two different types with this name exist, but they are unrelated.
      Property '_parent' is protected but type 'Subscription' is not a class derived from 'Subscription'.

ERROR in [at-loader] ./src/main/webapp/app/shared/alert/alert-error.component.ts:86:39
        TS2345: Argument of type 'Subscription' is not assignable to parameter of type 'Subscription'.
      Property '_parent' is protected but type 'Subscription' is not a class derived from 'Subscription'.

如果我通过执行以下操作“还原”这一步:
yarn add ng-jhipster
yarn start -> 一切都很好(使用真正的 NPM 依赖项)

我注意到本地链接的 ng-jhipster 与 yarn 从 NPM 存储库获取的存在一些差异: 使用本地链接的项目:
- node_modules 文件夹存在于myNewGeneratedApp/node_modules/ng-jhipster
- 没有“.js”文件。 (尚未执行打字稿转译)
- 所以还有 *.ts 文件

我不知道这是否异常,但与 NPM repo 的依赖关系(运行良好)与上述几点不同(至少)。
也许来自 ng-jhipster 的 release 脚本也需要运行(?)。 (对于npm run ngcnpm publish 步骤?)
我错过了这个过程吗?也许维基中缺少一个步骤?

它与这个问题有某种关系:ng-jhipster development creates compilation errors。 并且描述的步骤对我不起作用。

感谢您的帮助!

【问题讨论】:

    标签: jhipster


    【解决方案1】:

    在此处查看 ng-jhipster 项目中的自述文件:https://github.com/jhipster/ng-jhipster/blob/master/README.md

    【讨论】:

      【解决方案2】:

      那么我们可以在 ng-jhipster 项目上做些什么:

      yarn ngc
      yarn pack
      

      然后从您生成的 JHipster 应用程序中执行以下命令:

      git checkout -- yarn.lock 
      yarn cache clean ng-jhipster 
      rm -rf `yarn cache dir`/.tmp 
      yarn add path/to/ng-jhipster/ng-jhipster-vX.Y.Z.tgz
      

      【讨论】:

        猜你喜欢
        • 2017-10-07
        • 1970-01-01
        • 1970-01-01
        • 2020-02-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-11-23
        相关资源
        最近更新 更多