在生成的JHipster应用程序上设置ng-jhipster

时间:2017-11-02 22:29:49

标签: jhipster

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

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

$('#foo').submit(function (e) {
    $.post('/api/baz/break', $(this).serialize())
        .done(function (guidString) {
            // manipulate good result
        })
        .fail(function (data) {
            // manipulate bad result
        });
    e.preventDefault();
});

对于我新生成的JHipster应用程序,我执行以下步骤:
git version 2.15.0 node: v6.11.5 npm: 5.4.2 yarn: 1.2.1 yeoman: 2.0.0 (我得到v4.10.2)
yarn global add generator-jhipster
mkdir ~/v4.10.2
cd ~/myNewGeneratedApp:在这里我选择所有默认值(特别是Angular 4)
jhipster会自动执行,一切都很好)
然后我运行yarn install,一切都很顺利。

对于我的ng-jhipster,我执行以下步骤:
yarn start
cd ~
git clone https://github.com/jhipster/ng-jhipster
cd ng-jhipster(使用来自myNewGeneratedApp的"相同"依赖版本)

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

git checkout v0.2.12

我回到myNewGeneratedApp文件夹:

yarn install
yarn run test  
yarn run build  
yarn link

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

现在,当我运行cd ~/myNewGeneratedApp yarn link 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 - >一切都很好(使用真正的NPM依赖)

我注意到本地链接的ng-jhipster和纱线从NPM回购获得的差异: 与当地相关的项目:
- yarn start中存在node_modules文件夹 - 没有' .js'文件。 (打字稿翻译尚未执行)
- 所以仍然有* .ts文件

我不知道这是不是异常,但NPM回购(效果良好)的依赖性(至少)与上述点不同。
也许ng-jhipster的myNewGeneratedApp/node_modules/ng-jhipster脚本也需要运行(?)。 (适用于releasenpm run ngc步骤?)
我错过了这个过程吗?也许维基中只缺少一步?

这与此问题有关:ng-jhipster development creates compilation errors。 所描述的步骤对我来说并不起作用。

感谢您的帮助!

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:1)

那么我们可以对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