Развертывание приложения, созданного JHipster, в AWS через ECS с использованием ошибок AWS Fargate

#amazon-web-services #docker #jhipster #amazon-ecs #aws-fargate

#amazon-веб-сервисы #docker #jhipster #amazon-ecs #aws-fargate

Вопрос:

Развертывание сгенерированного приложения с помощью JHipster (версия: 5.8.2) в AWS с использованием подгенератора aws-containers дает ERROR! Cannot find module 'aws-sdk'

$ jhipster import-jdl blog.jh .

Содержание blog.jh:

 application {
  config {
    baseName blog,
    applicationType monolith,
    packageName org.jhipster.blog,
    authenticationType jwt,
    prodDatabaseType mysql,
    cacheProvider no,
    enableHibernateCache false,
    buildTool maven,
    clientFramework angularX,
    useSass false,
    testFrameworks [protractor]
  }
  entities *
}

entity Blog {
    name String required minlength(3),
    handle String required minlength(2)
}

entity Entry {
    title String required,
    content TextBlob required,
    date Instant required
}

entity Tag {
    name String required minlength(2)
}

relationship ManyToOne {
    Blog{user(login)} to User,
    Entry{blog(name)} to Blog
}

relationship ManyToMany {
    Entry{tag(name)} to Tag{entry}
}

paginate Entry, Tag with infinite-scroll
  
 $ jhipster aws-containers
INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing jhipster:aws-containers
INFO! Options: from-cli: true
ERROR! Cannot find module 'aws-sdk'
{ Error: Cannot find module 'aws-sdk'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/stane/Work/Lab/JHipster/blog.aws-containers/node_modules/generator-jhipster/generators/aws-containers/lib/ssm.js:19:13)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3) code: 'MODULE_NOT_FOUND' }
  

$ npm install aws-sdk выдал

ERROR! Cannot find module 'ora'

$ npm install ora

И дело дошло до:

 $ jhipster aws-containers
INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing jhipster:aws-containers
INFO! Options: from-cli: true
This AWS generator will help you deploy your JHipster app as a Docker container on AWS.
✔ Docker is installed
Installing AWS dependencies
✔ AWS credentials using profile default.
events.js:174
      throw er; // Unhandled 'error' event
      ^

TypeError: ora is not a function
    at spinner (/home/stane/Work/Lab/JHipster/blog.aws-containers/node_modules/generator-jhipster/generators/aws-containers/aws-client.js:120:21)
    at Object.listRegions (/home/stane/Work/Lab/JHipster/blog.aws-containers/node_modules/generator-jhipster/generators/aws-containers/aws-client.js:142:12)
    at module.exports.fetchRegion (/home/stane/Work/Lab/JHipster/blog.aws-containers/node_modules/generator-jhipster/generators/aws-containers/index.js:159:22)
    at Object.<anonymous> (/home/stane/Work/Lab/JHipster/blog.aws-containers/node_modules/yeoman-generator/lib/index.js:418:27)
    at /home/stane/Work/Lab/JHipster/blog.aws-containers/node_modules/run-async/index.js:25:25
    at new Promise (<anonymous>)
    at /home/stane/Work/Lab/JHipster/blog.aws-containers/node_modules/run-async/index.js:24:19
    at self.env.runLoop.add.completed (/home/stane/Work/Lab/JHipster/blog.aws-containers/node_modules/yeoman-generator/lib/index.js:419:13)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
Emitted 'error' event at:
    at Immediate.setImmediate (/home/stane/Work/Lab/JHipster/blog.aws-containers/node_modules/yeoman-generator/lib/index.js:427:22)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
    at process.topLevelDomainCallback (domain.js:120:23)
  

Комментарии:

1. Это ошибка в aws-containers генераторе. Вы можете запустить cd node_modules/generator-jhipster amp;amp; npm install aws-sdk progress uuid ora amp;amp; cd ../../ , чтобы обойти проблему, пока она не будет исправлена

2. Это работает! Спасибо

3. @JonRuddell, Ты должен опубликовать этот комментарий в качестве ответа. Кроме того, когда я только что получил эту ошибку, запуск npm audit fix исправил ее для меня

4. @user5927256: Удалось ли вам развернуть приложение в aws ecs?

5. да, я смог