在生成的JHipster应用上设置ng-jhipster [英] Setting up ng-jhipster on a generated JHipster app

查看:71
本文介绍了在生成的JHipster应用上设置ng-jhipster的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I would like to configure a cloned ng-jhipster project as a dependency for a generated JHipster app.

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

I'm using the following versions (from 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,一切开始顺利.

For my new generated JHipster application, I'm doing the following steps:
yarn global add generator-jhipster (I get v4.10.2)
mkdir ~/v4.10.2
cd ~/myNewGeneratedApp
jhipster: here I choose all the defaults (specially Angular 4)
(yarn install is automatically executed and everything is fine)
Then I run yarn start and everything is starting well.

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

For my ng-jhipster, I'm doing the following steps:
cd ~
git clone https://github.com/jhipster/ng-jhipster
cd ng-jhipster
git checkout v0.2.12 (to use the "same" dependency version from myNewGeneratedApp)

现在我正在阅读ng-jhipster Wiki,然后运行:

Now I'm reading the ng-jhipster wiki and I run:

yarn install
yarn run test  
yarn run build  
yarn link

我回到myNewGeneratedApp文件夹:

I go back to myNewGeneratedApp folder:

cd ~/myNewGeneratedApp 
yarn link ng-jhipster 

因此,在〜/myNewGeneratedApp/node_modules中,文件夹ng-jhipster可以很好地链接到我的本地ng-jhipster项目.

So in ~/myNewGeneratedApp/node_modules, the folder ng-jhipster is well link to my local ng-jhipster project.

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

Now when I run yarn start and I have the following errors:

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依赖性)

If I "revert" this step by doing:
yarn add ng-jhipster
yarn start -> everything is fine (using the real NPM dependency)

我注意到本地链接的ng-jhipster与纱线从NPM回购中获得的区别: 与本地链接的项目:
-node_modules文件夹位于myNewGeneratedApp/node_modules/ng-jhipster
中 -没有".js"文件. (尚未执行打字稿的翻译)
-因此,仍然存在* .ts文件

I noticed some differences between the ng-jhipster locally linked and the one that yarn gets from NPM repo: With the locally linked project:
- The node_modules folder exists in myNewGeneratedApp/node_modules/ng-jhipster
- There is no '.js' files. (the typescript transpilation has not been executed)
- So there are still the *.ts files

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

I don't know if this is abnormal but with the dependency from NPM repo (which is working well) differs (at least) with the above points.
Maybe the release script from ng-jhipster need to be run as well (?). (for npm run ngc and npm publish steps ?)
Did I missed something the the process ? maybe there is just a missing step in the wiki ?

与该问题有某种联系: ng-jhipster开发会导致编译错误. 而且所描述的步骤对我不起作用.

It is somehow related with this issue: ng-jhipster development creates compilation errors. And the steps described didn't work for me.

感谢您的帮助!

推荐答案

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

So what we can do on ng-jhipster project:

yarn ngc
yarn pack

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

and then from your generated JHipster application the following commands:

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

这篇关于在生成的JHipster应用上设置ng-jhipster的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆